-
users,whoandwcommands can be used to check the users logged into the system. -
/etc/passwdfile contains user info like username and home directory location. -
/etc/shadowcontains the username and hash. -
/etc/groupcontains info about groups. -
File and directory permissions can be viewed using
ls -la. -
Execute permission for a directory determines if the user can execute a command inside the directory.
-
Modifying permissions and ownership:
-
chmod g-w hello.txt- removes group-write permission -
chmod a=,u=r hello.txt- changes permission for all users to none, and adds read permission for user (file owner) -
chmod 664 hello.txt- read-write permission for user & group, and only read permissions for everyone else -
sudo chown mike hello.txt- change user ownership of file -
sudo chgrp mike hello.txt- change group ownership of file
-
-
sudo -u anotheruser cat restricted.txtallows us to read the file as another user. -
su newusercan be used to switch user. -
passwdcan be used to change the user's password;sudo passwd newuserto change another user's password.