Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-15-2011, 10:30 PM   #1
Senior Member
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Rep: Reputation: 30
How to set to this permission

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


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

Old 11-15-2011, 10:44 PM   #2
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,552

Rep: Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112

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:
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.

Last edited by suicidaleggroll; 11-15-2011 at 10:46 PM.
Old 11-16-2011, 12:56 AM   #3
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
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
chmod u=rwxs,g=sx,o=x filename
That's a unique combo; never seen it before...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't set PWD despite having sudo permission set. spoovy Linux - Newbie 7 03-04-2010 03:07 AM
Samba MODIFY permission needs 'x' permission set in Linux? jlinkels Linux - Software 6 11-13-2009 10:30 AM
Help me to set Permission Linux - Security 1 04-09-2009 07:36 AM
How to Set nobody Permission jamesnkk Linux - Newbie 13 08-12-2008 12:34 AM
how to set quota, a/c and permission gogo Linux - General 1 10-09-2001 02:54 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:14 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration