Chapter 4. User, Group and Permission

Superuser (Root User) vs. Normal User

Superuser (Root User) vs. Normal User
Tag:

In Linux, there are two types of users – a superuser and a normal user. The superuser is a special user account used for system administration. The superuser has permissions for all Linux system resources while normal users have limited access to Linux system resources depending on the permission setting for each file and directory.

Superuser

A superuser is a special user account used for system administration. It is also called root. As the default setting, the superuser is the owner of all system files and directories under the / (root) directory and has all permissions (read, write, and execute) for all system resources.

Normal users

Normal users are all users who are not the superuser. You can create multiple normal users. Typically, each user has their own home directory under the directory path of "/home". Normal users have limited access to directories and files beyond their own home directory. For example, although normal users can read several directories and files under the root directory, they cannot overwrite those directories and files. For some directories such as root (root user's home directory) and lost + found, normal users cannot even view directories and files underneath.

You can check by running the following command.

Command Line - INPUT
ls /lost+found
Command Line - RESPONSE
ls: cannot open directory '/lost+found': Permission denied

Practice

To see the difference between the superuser (root) and the normal user, let's check them on Linux OS.

1. Check the root directory

Go to the / (root) directory and execute the ls -l command.

Command Line - INPUT
cd /
ls -l

You'll see that the owner user and owner group are root (superuser).

Command Line - RESPONSE
total 64
lrwxrwxrwx   1 root root     7 Jul 16  2020 bin -> usr/bin
drwxr-xr-x   3 root root  4096 Dec 22 06:38 boot
drwxr-xr-x  15 root root  3180 Dec 21 12:53 dev
drwxr-xr-x  95 root root  4096 Dec 23 16:40 etc
drwxr-xr-x   3 root root  4096 Dec 21 09:22 home
lrwxrwxrwx   1 root root     7 Jul 16  2020 lib -> usr/lib
lrwxrwxrwx   1 root root     9 Jul 16  2020 lib32 -> usr/lib32
lrwxrwxrwx   1 root root     9 Jul 16  2020 lib64 -> usr/lib64
lrwxrwxrwx   1 root root    10 Jul 16  2020 libx32 -> usr/libx32
drwx------   2 root root 16384 Jul 16  2020 lost+found
drwxr-xr-x   2 root root  4096 Jul 16  2020 media
drwxr-xr-x   2 root root  4096 Jul 16  2020 mnt
drwxr-xr-x   3 root root  4096 Dec 22 01:52 opt
dr-xr-xr-x 142 root root     0 Dec 21 09:22 proc
drwx------   4 root root  4096 Dec 21 09:23 root
drwxr-xr-x  26 root root  1020 Dec 25 06:55 run
lrwxrwxrwx   1 root root     8 Jul 16  2020 sbin -> usr/sbin
drwxr-xr-x   8 root root  4096 Dec 21 12:52 snap
drwxr-xr-x   2 root root  4096 Jul 16  2020 srv
dr-xr-xr-x  13 root root     0 Dec 21 09:22 sys
drwxrwxrwt  12 root root  4096 Dec 25 06:54 tmp
drwxr-xr-x  14 root root  4096 Jul 16  2020 usr
drwxr-xr-x  13 root root  4096 Jul 16  2020 var

2. Check home directory

Go to the /home directory and execute the ls -l command.

Command Line - INPUT
cd /home
ls -l

You'll see that the owner user and owner group are ubuntu (normal user).

Command Line - RESPONSE
total 4
drwxr-xr-x 5 ubuntu ubuntu 4096 Dec 22 13:24 ubuntu

In Linux, there are two types of users – a superuser and a normal user. The superuser is a special user account used for system administration. The superuser has permissions for all Linux system resources while normal users have limited access to Linux system resources depending on the permission setting for each file and directory.

Superuser

A superuser is a special user account used for system administration. It is also called root. As the default setting, the superuser is the owner of all system files and directories under the / (root) directory and has all permissions (read, write, and execute) for all system resources.

Normal users

Normal users are all users who are not the superuser. You can create multiple normal users. Typically, each user has their own home directory under the directory path of "/home". Normal users have limited access to directories and files beyond their own home directory. For example, although normal users can read several directories and files under the root directory, they cannot overwrite those directories and files. For some directories such as root (root user's home directory) and lost + found, normal users cannot even view directories and files underneath.

You can check by running the following command.

Command Line - INPUT
ls /lost+found
Command Line - RESPONSE
ls: cannot open directory '/lost+found': Permission denied

Practice

To see the difference between the superuser (root) and the normal user, let's check them on Linux OS.

1. Check the root directory

Go to the / (root) directory and execute the ls -l command.

Command Line - INPUT
cd /
ls -l

You'll see that the owner user and owner group are root (superuser).

Command Line - RESPONSE
total 64
lrwxrwxrwx   1 root root     7 Jul 16  2020 bin -> usr/bin
drwxr-xr-x   3 root root  4096 Dec 22 06:38 boot
drwxr-xr-x  15 root root  3180 Dec 21 12:53 dev
drwxr-xr-x  95 root root  4096 Dec 23 16:40 etc
drwxr-xr-x   3 root root  4096 Dec 21 09:22 home
lrwxrwxrwx   1 root root     7 Jul 16  2020 lib -> usr/lib
lrwxrwxrwx   1 root root     9 Jul 16  2020 lib32 -> usr/lib32
lrwxrwxrwx   1 root root     9 Jul 16  2020 lib64 -> usr/lib64
lrwxrwxrwx   1 root root    10 Jul 16  2020 libx32 -> usr/libx32
drwx------   2 root root 16384 Jul 16  2020 lost+found
drwxr-xr-x   2 root root  4096 Jul 16  2020 media
drwxr-xr-x   2 root root  4096 Jul 16  2020 mnt
drwxr-xr-x   3 root root  4096 Dec 22 01:52 opt
dr-xr-xr-x 142 root root     0 Dec 21 09:22 proc
drwx------   4 root root  4096 Dec 21 09:23 root
drwxr-xr-x  26 root root  1020 Dec 25 06:55 run
lrwxrwxrwx   1 root root     8 Jul 16  2020 sbin -> usr/sbin
drwxr-xr-x   8 root root  4096 Dec 21 12:52 snap
drwxr-xr-x   2 root root  4096 Jul 16  2020 srv
dr-xr-xr-x  13 root root     0 Dec 21 09:22 sys
drwxrwxrwt  12 root root  4096 Dec 25 06:54 tmp
drwxr-xr-x  14 root root  4096 Jul 16  2020 usr
drwxr-xr-x  13 root root  4096 Jul 16  2020 var

2. Check home directory

Go to the /home directory and execute the ls -l command.

Command Line - INPUT
cd /home
ls -l

You'll see that the owner user and owner group are ubuntu (normal user).

Command Line - RESPONSE
total 4
drwxr-xr-x 5 ubuntu ubuntu 4096 Dec 22 13:24 ubuntu
Tag: