-
How to change login user in Linux (su)linux 2023. 2. 21. 10:54
The su command in Linux is used to switch to another user account. By default, it switches to the root user account if no other user is specified. The su command requires the password of the user being switched to.
su short for
- substitute user
- super user
- switch user
Here is the option table for the su command:
OptionDescription
-c <command> Execute the specified command as the new user -s <shell> Specify the shell to be used -l or --login Simulate a full login session for the new user <username> Switch to the specified user account Here are some examples of using the su command:
- Switch to the root user account:
su- Switch to a different user account:
su john- Switch to a different user account and execute a command:
su -c "ls -la /home" john- Switch to a different user account and start a new shell:
su -s /bin/bash john- Simulate a full login session for the root user:
su -l'linux' 카테고리의 다른 글
Standard error and standard input in Linux (0) 2023.02.21 How to redirect the input and output of commands and applications to and from files or other streams in Linux (0) 2023.02.21 How to manage user password expiration information in Linux (0) 2023.02.21 How to manage your root user in Linux (0) 2023.02.21 user security files in Linux (0) 2023.02.21