Linux Users

Linux Logo

Linux Users

New User

Add new user.
Depending on the distribution it may or may not create a home directory.
The configuration can be seen under /etc/default/useradd.
The new account will have a UID above 1000

sudo useradd xxx

Add new user & explicitly create a home directory.

sudo useradd -m xxx

Check User

If the user was created successfully it will have an entry in the /etc/passwd file

cat /etc/passwd | grep -i 'xxx'

Set Password For Self

sudo passwd xxx

Set Password Different User

sudo passwd

Create System Account

Create a System Account
The new account will have a UID below 1000
Most distributions will not display this user on the logon screen

sudo useradd -r sysuser

Delete User

Delete user leaving the home directory behind.

sudo userdel xxx

Delete user and its related resources

sudo userdel -r xxx

/etc/passwd

Lists all the users on the system. Also

user:x:1000:1000:user:/home/u:/bin/bash
  1. Column: UserName
  2. Column: Password( Historically ) Modern systems have a hashed password located at /etc/shadow
  3. Column: UID
  4. Column: GID
  5. Column: Gecos / User Information / Name ( Optional Field)
  6. Column: Home directory
  7. Column: Shell

/etc/shadow

user:$6$8dkZRIbbknoLsEgGjhgjyg786876V4w6UFwph:18390:0:99999:7:::
  1. Column: Username
  2. Column: Password Hash
  3. Column: Days since Unix Epoch since password was last changed
  4. Column: Days until the password can be changed again.
  5. Column: Days until a password change is required since Unix Epoch
  6. Column: Days before password expires that the user will be reminded to change password.
  7. Column: Days until user password will be locked
  8. Column: Days until account will be disabled
  • https://en.wikipedia.org/wiki/Epoch_(computing)