Updated: 2012-04-17 13:08 EDT

1 Topics Index up to index

USERS

/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

/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/passwd Index up to index

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

PASSWD FILE FORMAT: username:x:UID:GID:comment:home_directory:login_shell
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.1 Shadow Passwords - /etc/shadow Index up to index

2.2 useradd Index up to index

2.3 userdel Index up to index

2.4 usermod Index up to index

2.5 chsh Index up to index

2.6 passwd Index up to index

2.7 su Index up to index

2.8 sudo Index up to index

3 Groups: The Group File - /etc/group Index up to index

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

GROUP FILE FORMAT: groupname:x:GID:userid1,userid2,userid3
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.1 Group Shadow Passwords - /etc/gshadow Index up to index

3.2 Group Commands - groupadd, groupdel, groupmod, gpasswd, group, id, newgrp Index up to index

4 Changing Privilege - su, sudo, and newgrp Index up to index

4.1 su - substitute user or set userid Index up 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 su Index up 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 group Index up 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