Linux 101 : Changing users - "su" command -

To start using a different existing account in Linux, we could switch to another user through the below command:

We switch to a user_name, but we keep our shell profile settings. 

To switch to another user, and open a brand new shell under that new user, we use the below:

To give users temporary "root" privileges, we need to add them to a file called  "/etc/sudoers" as below.

We enter the command visudo under the root user which will open an editor, so we could modify the file "/etc/sudoers".

To give a user root privileges, we add the following:

To do the same, but without prompting the user to enter their password, we use:

To give a user the right to run a "priviliged" command, we add the line:

To be able to execute a command with root privileges, we use the below:


Leave as a comment: