Welcome to my blog!
Account settings and details are stored in some of the following directories and files.
The useradd command modifies the passwd, shadow, group, and gshadow files
Every user will belong to a single primary group, which is listed in the passwd file. A user can also belong to multiple secondary groups.
Adding and removing accounts with explanations and argument options.
Command | Description |
---|---|
useradd accountname | Create user. Makes a home directory and gives it default shell |
userdel accountname | Delete user. Doesn’t fully remove everything, use -r arguments |
userdel -r accountname | Deletes the user and associated mailbox/directory stuff |
passwd deleteme | Deletes the password and allows you to create a new one |
Command | Description |
---|---|
useradd -u 1500 username | u option Specifies a unique user ID (instead of default) |
useradd -g 1501 username | g option Specifies a unique group ID (instead of default) |
useradd -d /home/user8 u8 | d option Adds the user with a home directory of /user8 instead of the username “u8” |
useradd -M user9 | M option Doesn’t create a home directory |
Adding and removing accounts with explanations and argument options.
Command | Description |
---|---|
useradd -u 1500 username | u option Specifies a unique user ID (instead of default) |
useradd -g 1501 username | g option Specifies a unique group ID (instead of default) |
useradd -d /home/user8 u8 | d option Adds the user with a home directory of /user8 instead of the username “u8” |
useradd -M user9 | M option Doesn’t create a home directory |
The default shell specifies what program or process will be started when the user logs in.
Command | Description |
---|---|
useradd -s /bin/tcsh username | s option Sets the shell, here we specified tcsh |
useradd -D | D option Shows you what it can change |
useradd -D -s /bin/tcsh | D -s Changes the default shell for all new users |
Groups make it easier to control permissions for multiple users.
Command | Description |
---|---|
id username | Display users UserID, GroupID, and what groups they are in |
groups username | Display the group the user is in |
groupadd groupname | Add a group |
groupdel groupname | Remove a group |
usermod -a -G groupname username | Assign a secondary group to a user |
gpasswd -d username groupname | Remove a user from a group |
The default shell specifies what program or process will be started when the user logs in.
Command | Description |
---|---|
chfn username | As root you can change this for a user |
useradd -c “FirstName LastName” username | Don't use quotes if you only want to change first name |
useradd -c “Firstname Lastname,New York,444-4444,555-5555” username | Changing additional fields |