User Account Management Debian 11

From Vista Ridge Cyberpatriot
Revision as of 22:43, 9 November 2023 by 128.254.249.17 (talk) (added more things)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Common Commands For User Account Management

  • adduser <username> : Adds a user
  • sudo userdel <username> : Removes a user
  • sudo addgroup <groupname> : Adds a group
  • sudo delgroup <groupname> : Removes a group
  • sudo usermod -aG <groupname> <username> : Adds a user to a group
  • sudo gpasswd -d <username> <groupname> : Removes a user from a group

Usermod

Used to modify users, has many options/flags.

Basic format: sudo usermod <options> <username>

  1. -c = Add comment field for the useraccount.
  2. -d = To modify the directory for any existing user account.
  3. -e = Using this option we can make the account expiry in specific period.
  4. -g = Change the primary group for a User.
  5. -G = To add a supplementary groups.
  6. -a = To add anyone of the group to a secondary group.
  7. -l = To change the login name from tecmint to tecmint_admin.
  8. -L = To lock the user account. This will lock the password so we can’t use the account.
  9. -m = moving the contents of the home directory from existing home dir to new dir.
  10. -p = To Use un-encrypted password for the new password. (NOT Secured).
  11. -s = Create a Specified shell for new accounts.
  12. -u = Used to Assigned UID for the user account between 0 to 999.
  13. -U = To unlock the user accounts. This will remove the password lock and allow us to use the user account.