Updated: 2013-03-16 02:59 EDT

1 TopicsIndexup to index

USERS
  • user account files: /etc/passwd and /etc/shadow
  • useradd - add a user account
  • userdel - remove a user account
  • usermod - modify userid info, e.g. userid, UID, GID, etc.
  • chsh - change shell
  • passwd - change password
  • su - start a subshell: log in as a new userid
  • sudo - execute a single command as another userid
GROUPS
  • group account files: /etc/group and /etc/gshadow
  • groupadd - create a new group
  • groupdel - delete a group
  • groupmod - modify group name, GID, password
  • gpasswd - manage groups: set group administrator, add/delete members
  • groups - display all groups
  • id - display user UID and group GID and groups
  • newgrp - start a subshell: log in to a new group with a password

2 Users: The Password File - /etc/passwdIndexup to index

2.1 Password File Format - /etc/passwdIndexup to index

When a user is created on the system, the following information is stored in seven colon-separated fields in /etc/passwd:

username:x:UID:GID:comment:home_directory:login_shell
    1    2  3   4     5        6               7
root:x:0:0:Super User:/root:/bin/bash
idallen:x:500:500:Ian! D. Allen:/home/idallen:/bin/bash
  1. login userid (stored in variables $USER or $LOGNAME in the shell)
  2. encrypted password (or an x marker indicating use of /etc/shadow)
  3. User ID number (UID)
  4. Group ID number (GID) - but users can be in more groups, too
  5. Comments: any text information; often the user’s full name and/or office
  6. Home directory (absolute path): usually /home/$USER
  7. Login shell to give the user at login; usually /bin/bash

2.2 Shadow Passwords - /etc/shadowIndexup to index

2.3 useraddIndexup to index

2.4 userdelIndexup to index

2.5 usermodIndexup to index

2.6 chshIndexup to index

2.7 passwdIndexup to index

2.8 suIndexup to index

2.9 sudoIndexup to index

3 Groups: The Group File - /etc/groupIndexup to index

3.1 Group File Format - /etc/groupIndexup to index

When a group is created on the system, the following information is stored in four colon-separated fields in /etc/group:

groupname:x:GID:userid1,userid2,userid3
     1    2  3  4
root:x:0:
cdrom:x:500:idallen,alleni
  1. group name
  2. encrypted password (or an x marker indicating use of /etc/gshadow)
  3. Group ID number (GID)
  4. Optional list of userids that are members of that group

3.2 Group Shadow Passwords - /etc/gshadowIndexup to index

3.3 Group Commands - groupadd, groupdel, groupmod, gpasswd, group, id, newgrpIndexup to index

4 Changing Privilege - su, sudo, and newgrpIndexup to index

4.1 su - substitute user or set useridIndexup to index

[idallen@localhost]$ whoami
idallen
[idallen@localhost]$ su
password: XXX
[root@localhost]# whoami
root
[root@localhost]# exit 
[idallen@localhost]$
[idallen@localhost]$ whoami
idallen

4.2 sudo - do as if suIndexup to index

sudo 

[idallen@localhost]$ whoami
idallen
[idallen@localhost]$ sudo passwd alleni
[sudo] password for idallen: XXXXXXXXXX
Changing password for user alleni.
New password: XXX
Retype new password: XXX
passwd: all authentication tokens updated successfully.
[idallen@localhost]$ whoami
idallen
[idallen@localhost]$ 

4.3 newgrp - log in to a new groupIndexup to index

Author: 
| Ian! D. Allen  -  idallen@idallen.ca  -  Ottawa, Ontario, Canada
| Home Page: http://idallen.com/   Contact Improv: http://contactimprov.ca/
| College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/
| Defend digital freedom:  http://eff.org/  and have fun:  http://fools.ca/

Plain Text - plain text version of this page in Pandoc Markdown format

Campaign for non-browser-specific HTML   Valid XHTML 1.0 Transitional   Valid CSS!   Creative Commons by nc sa 3.0   Hacker Ideals Emblem   Author Ian! D. Allen