rh124_account_management

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rh124_account_management [2026/10/19 19:10] – [cat /etc/group (partial)] rpjdayrh124_account_management [2026/10/19 20:02] (current) – [Changing someone's password] rpjday
Line 144: Line 144:
 uid=1000(rpjday) gid=1000(rpjday) groups=1000(rpjday),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 uid=1000(rpjday) gid=1000(rpjday) groups=1000(rpjday),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
 </code> </code>
 +
 +You do not need an entry in ''/etc/group'' for your account's primary group.
 ==== cat /etc/shadow (secure) ==== ==== cat /etc/shadow (secure) ====
  
Line 165: Line 167:
 ===== Account management ===== ===== Account management =====
  
-==== Creating a new account ==== +==== How class accounts are created ====
- +
-=== How class accounts are created ===+
  
 For each account: For each account:
Line 176: Line 176:
 </code> </code>
  
-=== useradd ===+==== useradd ====
  
 The output from ''%%useradd --help%%'': The output from ''%%useradd --help%%'':
Line 284: Line 284:
   -P, --prefix PREFIX_DIR       prefix directory where are located the /etc/* files   -P, --prefix PREFIX_DIR       prefix directory where are located the /etc/* files
   -Z, --selinux-user            remove any SELinux user mapping for the user   -Z, --selinux-user            remove any SELinux user mapping for the user
 +</code>
 +
 +==== Changing someone's password ====
 +
 +<code>
 +$ passwd user0
 +</code>
 +
 +Note ''%%--stdin%%'' option to set password:
 +
 +<code>
 +$ passwd --help
 +Usage: passwd [options] [LOGIN]
 +
 +Options:
 +  -a, --all                     report password status on all accounts
 +  -d, --delete                  delete the password for the named account
 +  -e, --expire                  force expire the password for the named account
 +  -h, --help                    display this help message and exit
 +  -k, --keep-tokens             change password only if expired
 +  -i, --inactive INACTIVE       set password inactive after expiration
 +                                to INACTIVE
 +  -l, --lock                    lock the password of the named account
 +  -n, --mindays MIN_DAYS        set minimum number of days before password
 +                                change to MIN_DAYS
 +  -q, --quiet                   quiet mode
 +  -r, --repository REPOSITORY   change password in REPOSITORY repository
 +  -R, --root CHROOT_DIR         directory to chroot into
 +  -P, --prefix PREFIX_DIR       directory prefix
 +  -S, --status                  report password status on the named account
 +  -u, --unlock                  unlock the password of the named account
 +  -w, --warndays WARN_DAYS      set expiration warning days to WARN_DAYS
 +  -x, --maxdays MAX_DAYS        set maximum number of days before password
 +                                change to MAX_DAYS
 +  -s, --stdin                   read new token from stdin
 +</code>
 +
 +<code>
 +$ echo "password" | passwd --stdin user0
 </code> </code>
  
Line 349: Line 388:
 $ man 1 chsh $ man 1 chsh
 $ man 1 chfn $ man 1 chfn
-</code> 
- 
-===== Managing user accounts ===== 
- 
-==== passwd ==== 
- 
-<code> 
-$ passwd user0 
-</code> 
- 
-==== usermod ==== 
- 
-<code> 
-$ usermod --help 
-Usage: usermod [options] LOGIN 
- 
-Options: 
-  -a, --append                  append the user to the supplemental GROUPS 
-                                mentioned by the -G option without removing 
-                                the user from other groups 
-  -b, --badname                 allow bad names 
-  -c, --comment COMMENT         new value of the GECOS field 
-  -d, --home HOME_DIR           new home directory for the user account 
-  -e, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE 
-  -f, --inactive INACTIVE       set password inactive after expiration 
-                                to INACTIVE 
-  -g, --gid GROUP               force use GROUP as new primary group 
-  -G, --groups GROUPS           new list of supplementary GROUPS 
-  -h, --help                    display this help message and exit 
-  -l, --login NEW_LOGIN         new value of the login name 
-  -L, --lock                    lock the user account 
-  -m, --move-home               move contents of the home directory to the 
-                                new location (use only with -d) 
-  -o, --non-unique              allow using duplicate (non-unique) UID 
-  -p, --password PASSWORD       use encrypted password for the new password 
-  -P, --prefix PREFIX_DIR       prefix directory where are located the /etc/* files 
-  -r, --remove                  remove the user from only the supplemental GROUPS 
-                                mentioned by the -G option without removing 
-                                the user from other groups 
-  -R, --root CHROOT_DIR         directory to chroot into 
-  -s, --shell SHELL             new login shell for the user account 
-  -u, --uid UID                 new UID for the user account 
-  -U, --unlock                  unlock the user account 
-  -v, --add-subuids FIRST-LAST  add range of subordinate uids 
-  -V, --del-subuids FIRST-LAST  remove range of subordinate uids 
-  -w, --add-subgids FIRST-LAST  add range of subordinate gids 
-  -W, --del-subgids FIRST-LAST  remove range of subordinate gids 
-  -Z, --selinux-user SEUSER     new SELinux user mapping for the user account 
-      --selinux-range SERANGE   new SELinux MLS range for the user account 
- 
 </code> </code>
  
Line 473: Line 462:
 To give someone superuser access, add them to the ''wheel'' group. To give someone superuser access, add them to the ''wheel'' group.
  
-===== Deleting groups and users =====+
  
 ==== Deleting groups ==== ==== Deleting groups ====
Line 488: Line 477:
 </code> </code>
  
-==== Deleting users ====+==== groupmems ====
  
 <code> <code>
-$ userdel --help +$ groupmems --help 
-Usage: userdel [options] LOGIN+Usage: groupmems [options] [action]
  
 Options: Options:
-  -f, --force                   force some actions that would fail otherwise +  -g, --group groupname         change groupname instead of the user's group 
-                                e.g. removal of user still logged in +                                (root only)
-                                or files, even if not owned by the user +
-  -h, --help                    display this help message and exit +
-  -r, --remove                  remove home directory and mail spool+
   -R, --root CHROOT_DIR         directory to chroot into   -R, --root CHROOT_DIR         directory to chroot into
-  -P, --prefix PREFIX_DIR       prefix directory where are located the /etc/* files + 
-  -Z, --selinux-user            remove any SELinux user mapping for the user+Actions: 
 +  -a, --add username            add username to the members of the group 
 +  -d, --delete username         remove username from the members of the group 
 +  -h, --help                    display this help message and exit 
 +  -p, --purge                   purge all members from the group 
 +  -l, --list                    list the members of the group
 </code> </code>
 +
 +===== Giving someone superuser access =====
 +
 +First, add them to the ''wheel'' group so they can use the ''sudo'' command; they will still have to type their password.
 +
 +<code>
 +$ usermod -aG wheel user1
 +</code>
 +
 +In addition, add this line to either ''/etc/sudoers'' or a file under ''/etc/sudoers.d'':
 +
 +<code>
 +user1 ALL=(ALL) NOPASSWD: ALL
 +</code>
 +
 +
  • rh124_account_management.1792437044.txt.gz
  • Last modified: 2026/10/19 19:10
  • by rpjday