Users and Groups - noyage/redhat GitHub Wiki

List Users

  • $ cat /etc/passwd note this is a world-readable file
    • the format of the passwd file is based on the GECOS format
    • username : x : UID : GID : comment : home directory : shell
  • $ cat /etc/shadow only accessible to the root user

Create user

  • make group first
    • # groupadd (groupname) <-- takes next available GID
    • # groupadd -g GID (groupname) <-- to specify GID number *# useradd -c "comment field" -d /home/username -s /bin/bash -u UID -g GID -m username

Available shells

  • $ cat /etc/shells

Delete user

  • # usedel (username)

Modify user

  • old school way (risky): # vipw
  • change shell
    • $ usermod --shell /bin/bash (username)
    • $ chsh --shell /bin/ksh (username)

chage command

* Set and alter password aging parameters among users

/etc/passwd file

  • user1:x:1000:1000:RegularUser:/home/user1:/bin/bash

  • username : encrypted password : uid : gid : GECOS : home directory : type of shell

Shadow file

  • user passwords are encrypted

  • user : encrypted password : lastchg days : min days : max days : warn days : inactive days: disabled days : not used

gshadow file

  • Provides an added layer of protection on the group level. Group passwords can be encrypted and stored in /etc/gshadow
  • only readable as root * user1 : encrypted password : groupadmins : members
⚠️ **GitHub.com Fallback** ⚠️