Basic Linux User administration Commands

  1. useradd -s /sbin/nologin username : It will prevent user to login to server
  2. userdel -r username: -r delete everything( home directory,mail spool) without -r it will just delete account references from user and groups
  3. usermod -L username : -L to disable user account
  4. usermod -U username : -U enable the user account.
  5. echo ‘mypassword’ | passwd –stdin username : allow to pipe a new plain text password.
  6. groupadd [ [-g gid [-o]] [-r] [-f] groupname : -f to force groupadd to accept an existing group name, -r to create a system group
  7. gpasswd [ -A username] [-M usrname] groupname : -A username to assign username as groupnames’s group administrator. – M username adds username to groupname’s membership roster.
  8. who [-Hil] | [-q] : -H options to add column heading to who’s output, -i to add users idle time, -l force to show fully qualified domian , -q to obtain total number of logged in users.

w [-husf] [username] : by defautl w prints header information. -h disable header information.-s generate the sort output. -f disable the host

informaition.

Leave a Reply