How to Setuid, setgid and sticky bit:

Setuid, setgid and sticky bit
Till now you have used three octal numbers for permissions for three types of users,
i.e. Owner, group and others. These three octal numbers / digits have values from

000 till 777 , representing: “no permissions to any one” till “all permissions for
everyone”, respectively. There are in fact four octal number positions designed for
file and directory permissions. The fourth number happens to be on the left side of any permission set, and if not present, then is assumed to be 0 (zero). This number can be 1 or 2 or 4 maximum and it's special meaning are below:

1 Sticky bit
2 Set group ID on execution
4 Set user ID on execution

Now first sticky bit :
If sticky bit permission is applied on a file like :
[root@mainserver / ]# chmod 1755 myfile.txt
, then as per the man page:
“On older Unix systems, the sticky bit caused executable files to be
hoarded in swap space. This feature is not useful on modern VM
systems, and the Linux kernel ignores the sticky bit on files. Other kernels
may use the sticky bit on files for system-defined purposes. On
some systems, only the superuser can set the sticky bit on files.”
What this means is that sticky bit on files is useless in linux.
Sticky bit on a file can be checked by the ls command. The “ T ” indicates that this file has sticky bit on.

[root@mainserver / ]# ls -l
-rw-r--r-T 1 root root 4847 Jul 8 12:26 myfile.txt
And if sticky bit is implemented on a directory like:
[root@mainserver / ]# chmod 1777 mydirectory
, then as per the man page:
“When the sticky bit is set on a directory, files in that directory may
be unlinked or renamed only by root or their owner. Without the sticky
bit, anyone able to write to the directory can delete or rename files.
The sticky bit is commonly found on directories, such as /tmp, that are
What this means is that sticky bit on a directory allows users to create files in that
directory with a facility that only root or the user who created the file will be able to
delete or rename the file.
Sticky bit on a directory can be checked by the ls command. The “ t ” indicates that
this file has sticky bit on. A common example is the /tmp directory on Linux.
[root@mainserver / ]# ls -l
drwxrwxrwt 21 root root 4096 Jul 13 17:39 tmp

Forex Trading