Commit 858a149b authored by Jyothis Jagan's avatar Jyothis Jagan

Update session4.md

parent 70c2114e
......@@ -11,12 +11,14 @@ Basically, there are three types of users - normal users, system users and an ad
uid=0(root) gid=0(root) groups=0(root),986(adbusers)
`whoami` gives the username of the current user
jyothisjagan@jyothisjagan:~$ whoami
jyothisjagan
jyothisjagan@jyothisjagan:~$ echo $USER
jyothisjagan
`sudo` or `su` can be used to get root access in a system. **Never use root user if that can be done as a normal user.** A user has to be either in */etc/sudoers* or member in *sudo* group in order to get root access.
jyothisjagan@jyothisjagan:~$ su
Password:
root@jyothisjagan:/home/jyothisjagan#
......@@ -24,19 +26,24 @@ Basically, there are three types of users - normal users, system users and an ad
You can also give sudo access to only specific commands to some users and there are many options to give finer access.
Let us create a user named *testuser* with the command `useradd`. *-d* option can be used to create home directory and *-D* can be used for defaults.
sudo useradd testuser
a group can be created using the command `groupadd`
sudo groupadd testgroup
The *testuser* can be added to *testgroup* using the command `usermod` or `adduser`.
sudo usermod -aG testgroup testuser
or,
sudo adduser testuser testgroup
Now, if we check the groups *testuser* is part of, we can see *testgroup* as well.
jyothisjagan@jyothisjagan:~$ groups testuser
testuser : testuser testgroup
......@@ -45,6 +52,7 @@ Another commonly used group is `sbuild` when doing debian packaging. Usually sbu
## File Permissions
Refer [Permissions](https://ryanstutorials.net/linuxtutorial/permissions.php)
ls -l /usr/bin/sudo
-rwsr-xr-x 1 root root 157192 ഒക്ടോ 12 19:19 /usr/bin/sudo
......@@ -61,4 +69,5 @@ There lies the purpose of suid permissions. The letter s in the third field of p
Refer [Sticky Bit, SUID and SGID in Linux with Examples](https://linoxide.com/how-tos/stickbit-suid-guid/)
Exercise : Create three users and add all of them to a group. Then create a directory common to all the three users where all three users can write.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment