SUID is Set owner User ID.
When SUID is used?
Eg: You are a Super administator and can run commands like "fdisk -l" from root user.
But what if in your absence, you want this command to run by a normal user.
"fdisk -l" will not give any output when run with normal user account.
One option is to give sudors permission to the normal user and then user can run the command. But there is risk in this. Sudoers will allow normal user to run all the root commands.
To prevent this and allow the normal user to run only one command, SUID is used. After setting SUID for /sbin/fdisk, then normal user will be get the result for "fdisk -l"
SUID info:
Permission Number : 4
To set SUID:
# chmod u+s <filename>
To remove SUID:
# chmod u-s <filename>
Eg:
Before permission of /sbin/fdisk
ls -l /sbin/fdisk
-rwxr-xr-x 1 root root 267176 Aug 5 06:55 /sbin/fdisk
Setting SUID for /sbin/fdisk
#chmod u+s /sbin/fdisk
Now permission of /sbin/fdisk will be
ls -l /sbin/fdisk
-rwsr-xr-x 1 root root 267176 Aug 5 06:55 /sbin/fdisk
You will notice S in the owner permission.
Note:
You can also use numeric value to set SUID.
To set
chmod 4755 /sbin/fdisk
To unset
chmod 0755 /sbin/fdisk
When SUID is used?
Eg: You are a Super administator and can run commands like "fdisk -l" from root user.
But what if in your absence, you want this command to run by a normal user.
"fdisk -l" will not give any output when run with normal user account.
One option is to give sudors permission to the normal user and then user can run the command. But there is risk in this. Sudoers will allow normal user to run all the root commands.
To prevent this and allow the normal user to run only one command, SUID is used. After setting SUID for /sbin/fdisk, then normal user will be get the result for "fdisk -l"
SUID info:
Permission Number : 4
To set SUID:
# chmod u+s <filename>
To remove SUID:
# chmod u-s <filename>
Eg:
Before permission of /sbin/fdisk
ls -l /sbin/fdisk
-rwxr-xr-x 1 root root 267176 Aug 5 06:55 /sbin/fdisk
Setting SUID for /sbin/fdisk
#chmod u+s /sbin/fdisk
Now permission of /sbin/fdisk will be
ls -l /sbin/fdisk
-rwsr-xr-x 1 root root 267176 Aug 5 06:55 /sbin/fdisk
You will notice S in the owner permission.
Note:
You can also use numeric value to set SUID.
To set
chmod 4755 /sbin/fdisk
To unset
chmod 0755 /sbin/fdisk
Comments
Post a Comment