Page 34 - RHEL8 BOOK
P. 34
1. Add a new user
[root@comp1 ~] # useradd <username>
[root@comp1 ~] # useradd tom
2. To filter single user properties
[root@comp1 ~] # grep tom /etc/passwd
3. To check last 10 lines of /etc/passwd
[root@comp1 ~] # tail /etc/passwd
4. To check top lines of user’s file
[root@comp1 ~] # head /etc/passwd
5. To assign password on tom user
[root@comp1 ~] # passwd tom
6. To check password properties of tom user
[root@comp1 ~] # grep tom /etc/shadow
7. Verification (open another GUI to login with new user)
[root@comp1 ~] # gdmflexiserver
[root@comp1 ~] # useradd <options> <username>
Options:
-u – UID (2000 changing the user id)
-c – Comment (“Manager” changing new comment)
-d - Home directory (/sales changing new directory)
-s – Shell (/bin/csh changing a user login name)
-l – /bin/csh (changing a user login name)
-L – /bin/csh (To lock a user account)
-U – /bin/csh (Unlock a user account)
8. Create a user ali whose user id is 2001
[root@sun ~] # useradd -u 2001 ali
[root@sun ~] # grep ali /etc/passwd
ali:x:2001:2001::/home/ali:/bin/bash
9. Create a user tom whose comment “Manager”
[root@sun ~] # useradd -c "Manager" tom
[root@sun ~] # grep tom /etc/passwd
tom:x:2002:2002:Manager:/home/tom:/bin/bash
10. Create a user ram whose home directory exist in /salesdept folder
[root@sun ~] # mkdir /salesdept
[root@sun ~] # useradd -d /salesdept/ram ram
[root@sun ~] # grep ram /etc/passwd
ram:x:2003:2003::/salesdept/ram:/bin/bash
S. Pradhan
(MCA, MBA-IT, BCA, CCNA, MCSA 2012, RHCE, ETHICAL HACKING)
Email Id:-spradhan.iiht@gmail.com
34