Chapter 10. Managing users

su username

(Switch User), change to a different user.

Use su - to switch to root or su username, to switch to a different username.

Using sudo: Its often considered better practice to use the sudo command rather than switch to the root user

The sudo command allows you to perform actions as root but logs the actions you take (so you can trace anything that was done to the system by yourself or others). sudo has a very good manual page which provides plenty of information about it.

You use sudo similar to how you execute a normal command with sudo prepended to it, for example:

 sudo rpm -U myrpm.i386.rpm 

This would allow you to install a rpm even if you have the correct sudo access

Note that if you want to return to your original user you don't use su again, type exit or press CTRL-D .

Simply typing su will give you some root privileges, but there are minor complications relating to environment variables. It's generally considered better practice to use su - because it has no restrictions.


The superuser. This user has power over everything and all, and can do anything with the system (including destroy it, and of course fix it :)). This user is used to perform most administration functions on the system.


All user information is normally listed in the “/etc/passwd” file and the group information in the “/etc/groups” file.

If you need to edit either file it is recommended that you use vipw to edit the password file and vigr to edit the group file. These particular commands take care of any processing and locking of the files before and after editing them.

There is a lot of information about adding/removing/controlling users and groups, this information is only the minimal information required.


Used to change your login shell.

To list the shells available type:

chsh --list-shells

Simply type chsh then [Enter], then type the name of the shell you would like to use every time you login.


Change finger information.

The information this command changes is reflected in the /etc/passwd file, use this utility to update your real name, office and home phone numbers (if they exist).

Use the -f option to change a users full name. Use this tool as either chfn or chfn user_name (usable by root only).

Command syntax:

chfn user_name

Changes the password of a user. You will need to be root if you want to change other users passwords.

Simply type passwd to change your own password or to change another users password type:

passwd username