Important Files:
/etc/skell
- Skeleton folder/etc/passwd
- Password file/etc/group
- Group file/etc/default/useradd
- Default variables for useradd/etc/login.defs
- The /etc/login.defs file defines the site-specific configuration for the shadow password suite. This file is required. Absence of this file will not prevent system operation, but will probably result in undesirable operation.Note that the shadow file, no one has permission:
$ ll /etc/shadow
----------. 1 root root 887 Jan 29 2019 /etc/shadow
Commands:
$ id
uid=1000(victor) gid=1000(victor) groups=1000(victor),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
📝 NOTE: When running for your own user, the highlighted text is shown
This can be used to show information on local and directory services.
Shows /etc/passwd entry for user 'victor'
# getent passwd victor
victor:x:1000:1000:victor:/home/victor:/bin/bash
Shows /etc/shadow entry for user 'user1'
# getent shadow user1
user1:$6$i5IgGA0XFP/f3Hv3$./zCBLGuL24fc8njwvsGJlsgrB.QJzf1srrHMUpDzxgYyqwlepHrKUhbu.k9iwOMxLsdRuu.oNiRItGZiKNZE.:18592:0:99999:7:::
Shows all users in the system
# getent passwd
Shows all groups in the system
# getent group
Useful command options:
c
- Commentd
- Set home directoryg
- Set the GIDG
- Secondary groupsk
- Skeleton directoryp
- The encrypted password, as returned by cryptr
- Create a system accounts
- Default login shellu
- Set the UIDAdd a user named 'user1' with uid '1001' and the existing 'users' group
# useradd -u 1001 -g 100 user1
# id user1
uid=1001(user1) gid=100(users) groups=100(users)
Useful command options:
c
- Modify user's commentd
- change the user's home directoryG
- chage the user's secondary groupL
- Locks the accountU
- Unlocks the account📝 NOTE: Locking the account adds a '!' at the beginning of the hash in /etc/shadow