Linux Guide/Logging In

Linux supports multiple users on a machine, even at the same time. Each user must log in with his or her user name and password. Every user belongs to one or more groups. Users and groups are important in determining permissions. All the users are listed in /etc/passwd and all the groups are listed in /etc/groups. To find out your user name and groups you belong to, run the id command

$ id
uid=501(myname) gid=501(mygroup) groups=501(mygroup),502(anothergroup)

The numbers are user and group ids, which are numbers that are associated with the user and group in /etc/passwd and /etc/group, respectively. These numbers are what the system uses internally, so you don't have to look at them, but you can use them in place of user and group names in certain commands (like chown). The human-readable names are shown in parentheses.

You can change your group to any group in groups or to a group that has a group password by using the newgrp command. You can also change to a different user entirely without logging out and in again by using the su command. Changing your user and/or group not only changes what files you can access, but the user and group of any files you create.

Both of these commands put you in a new shell, and you have to exit the shell or logout to stop using the new group or user. If you just need to be user root to run one command (which is rather common on a UNIX machine, for doing administrative tasks), the sudo command is what you want.

Users and groups can be managed from an administrative GUI or from a shell with the commands

useradd
usermod
userdel
groupadd
groupmod
groupdel

which add, modify, or delete a user or group. You will have to be user root to run these commands.