Linux Advanced File Permission Introduction

Sticky Bit on Directory

The Linux or Unix file permission is so much important thing of Linux and Unix system. Every Linux files can be protect in a directory from getting remove by other users. Which are do not own it by preventing it with sticky bit. That can displayed at the same location as the x permission for others.

That is present by a t (x is also there) or a T (no x is there).

Like example of :

# chmod +t new1  

See your terminal after run the command, permission for file new1 is change to t at place of x permission for others.

Normally, sticky bit is found on /tmp directory.

setgid Bit on Directory

Surely all the files in the directories are own by the group owner of directory, setgid can be use in the system.

That is can displayed on the same location as x permission for group. Which are represent by a s x is also there or a S no x is there.

Linux group owner is change into new for the directory new1. The Linux or Unix group permission is change into s at the place of x permission for group.

Now you can see that file1 which is inside directory ‘new1’ has the group name as ‘new‘.

setgid and setuid on Regular Files

These two permissions, an executable file is access with the permissions of the file owner instead of the executing owner.

That means that if a program has root user and setuid permission is set on it. So that a user will run that program as root. So it can be dangerous as well as good for the security.

This time, passwords which are store in /etc/shadow are readable by root only as shown below.

If a user run passwd command, then this time executes with the root credentials.

Now if you understand this article, Then you can practice your terminal. If you can practice more and more then you will gain something. Thank you.