User management
User management
User Management
• We create user
john .when you run
cat /etc/passwd you
will see the
information for john
• 1st 1001 is UID
• 2nd 1001 is GID
• Password information is saved
in /etc/shadow
• 17600:0:99999:7::: it shows
aging information .After how
long it will expire the password
Password
• User “tab tab” can give you different options
• X in /etc/passwd means password has been saved in etc/shadow
• Linux understand UID so if you change john user id to 0 then will be root
• To change the user id first we need to check it has
been used before or not
• We change the user id of john from 1001 to 7070
• You can use id to see who has logged in by id OR whoami commands
• We create few files under john home
directory then we exit
• We delete user john
• After going to cd /home/john we see the files
are there even user john is deleted
• In production we delete the user but we keep
their home directory as the files there
• If you want to delete the home directory then
run it with -r
• We create two different supplementary group – dba and apps
• When we add apps it will overwrite dba supplementary group
• -G is for secondary or supplementary group
• Our primary group is john
• So to avoid it we run –a and as you can see both groups are there
• If you want to change the primary group from john to dba you use “-g”
• cat /etc/group will provide you the group information
• To check the property of
directory we run ls –ld /etc
• To check the contents of directory we run ls –l /etc
• We change the permission of file 1
• To change the owner I use chown
• To change the group owner we use chgrp. We change the group owner from root to dba
• You logged in as root and you created a directory named “Apps”
• We changed the owner from root to john for directory apps (chown)
• We changed the owner group from root to apps for directory apps (chgrp)
• Owner group for apps directory is apps
• If we create files under apps directory the owner group
will be root not apps so its not inherited
• Group owner can inherit when you use g+s
• Ls –ld can be run to show the property of directory
• S means its inherited
• When you create new files in apps directory like abc* you
noticed that the owner group has been changed to apps
• To remove we use g-s