LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to set to this permission (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-set-to-this-permission-913751/)

ust 11-15-2011 09:30 PM

How to set to this permission
 
I have a file , this file must be in the following permission if we want to use it.

-rws--s--x

I tried to use chmod +s file_name but not work , can advise how to change the mode ? besides , what is "s" permission means ?

Thanks.

suicidaleggroll 11-15-2011 09:44 PM

http://www.comptechdoc.org/os/linux/..._ugfilesp.html

Quote:

The file permissions bits include an execute permission bit for file owner, group and other. When the execute bit for the owner is set to "s" the set user ID bit is set. This causes any persons or processes that run the file to have access to system resources as though they are the owner of the file. When the execute bit for the group is set to "s", the set group ID bit is set and the user running the program is given access based on access permission for the group the file belongs to. The following command:

chmod +s myfile

sets the user ID bit on the file "myfile". The command:

chmod g+s myfile

sets the group ID bit on the file "myfile".



Hopefully this is of some use, I've never used the s flag for permissions, so I don't have any personal experience with it.


From what I can tell, this would give you the permissions you seek:
Code:

chmod 711 file
chmod u+s file
chmod g+s file

There's probably a way to do it in fewer commands, but like I said I have no experience with the "s" permission flag.

chrism01 11-15-2011 11:56 PM

Code:

chmod ug+s filename
It's very unusual to have setuid & setgid on the same file. Are you sure that's right?

To set all perms as above
Code:

chmod u=rwxs,g=sx,o=x filename
That's a unique combo; never seen it before...


All times are GMT -5. The time now is 03:39 AM.