1833852 Members
2293 Online
110063 Solutions
New Discussion

File Permission

 
SOLVED
Go to solution
Sanjiv Sharma_1
Honored Contributor

File Permission

Hi,

What is the difference between the following file permission of abc1 and abc2:
-rwsr-sr-- 1 root informix 242 Jun 13 2002 abc1
-rwSr-Sr-- 1 root informix 242 Jun 13 2002 abc2

What is the meaning of small "s" and capital "s" and where are they used?

Thanks,
Raje.
Everything is possible
4 REPLIES 4
T G Manikandan
Honored Contributor

Re: File Permission

Hello,
rws

s setuid with execute permissions
rwS
S setuid without execute permissions

The first one is for the user(setuid)

The next one
r-s
setgid with execute permissions
r-S
setgid without execute permissions

Thanks
T G Manikandan
Honored Contributor
Solution

Re: File Permission

The use of the setuid and setgid is that

When a file is executed by a user he gets the permission of the owner during the execution of that file.
For ex.
consider you have the /etc/passwd file and the /usr/bin/passwd .

Normally the user cannot alter the /etc/passwd file as he has no permissions.
But when he is using the passwd command he is able to change it.
If you check the /usr/bin/passwd permissions

it is -r-sr-xr-x
So when the /usr/bin/passwd command is executed by the normal user he gets the permission of root during the execution of the command as he has the setuid set for that command.
During the execution he has the permissions of the owner.

Thanks

Steven Sim Kok Leong
Honored Contributor

Re: File Permission

Hi,

The small s and big S is used to differentiate whether executable bits are set.

-rwS------

The big S in the first set (user portion) means setuid bits has been set without executable bits on.

----rwS---

The big S in the 2nd set (group portion) means setgid bits has been set without executable bits on.

If the executabie bits have been set before the setuid/setgid bits are set, then it will use the small letter s.

An example will be clearer:

# touch a
# ll a
-rw-r--r-- 1 root root 0 Jun 14 13:45 a
# chmod +s a
# ll a
-rwSr-Sr-- 1 root root 0 Jun 14 13:45 a
# chmod +x a
# ll a
-rwsr-sr-x 1 root root 0 Jun 14 13:45 a
# touch b
# ll b
-rw-r--r-- 1 root root 0 Jun 14 13:47 b
# chmod +x b
# ll b
-rwxr-xr-x 1 root root 0 Jun 14 13:47 b
# chmod +s b
# ll b
-rwsr-sr-x 1 root root 0 Jun 14 13:47 b

Hope this helps. Regards.

Steven Sim Kok Leong
U.SivaKumar_2
Honored Contributor

Re: File Permission

Hi,
eg.
#touch test
#chmod u+s test
sets setuserid suid rwsr
#chmod g+S test
sets setgroupid sgid rwS

regards,
U.SivaKumar

Innovations are made when conventions are broken