Hello folks! If you have been here for the last two blogs, we have already discussed about the basic commands that can prove useful in navigating through Linux. Now that we are comfortable with the basics, let's take a dive into few of the more advanced topics here. Let's get started!!
User/Group management:
useradd -m Janahvi #to create user account
grep /JanahviT/etc/passwd #to check user account properties
passwd JanahviT #to create user account password
grep JanahviT /etc/shadow #to check user password property
su JanahviT #to switch user
exit #to logout from the user
userdel JanahviT #to delete a user
usermod -l DevOps JanahviT #to change user login name
groupadd Practice #to add group account
grep Practice/etc/gshadow #to check group admin property
gpasswd -a JanahviNew Practice #to add single member in group
gpasswd -M user1 user2 user3 Practice #to add multiple members in a group
gpasswd -d user1 Practice #to remove a group member from the group
gpasswd -A JanahviNew Practice #to make group admin
File permissions:
Permission groups:
user/owner (u): permission given to owner of the file
group (g): permission given to all members of the group
others (o): permission given to all other users
Permission set:
To add read permission to owner :
chmod u+r file1.txt or chmod 400 file1.txt
To add read write permission to group:
chmod g+rw file2.txt or chmod 060 file2.txt
To remove read permissions from others:
chmod o-r file3.txt
For ownership change:
chown <user name> <file/directory name>
For changing group ownership:
chgrp <group name> <file/directory name>