LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 02-24-2011, 04:10 AM   #1
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 610

Rep: Reputation: 31
How to enable sticky bit to a group .


I have created a user smith by
Code:
[root@localhost ~]#useradd smith
and then create a group marketing
Code:
[root@localhost ~]#useradd marketing
I want that even if the root will crtae a file or directory it will fall into group marketing.For that purpose I use sticky bit.
Code:
[root@localhost ~]#chmod g+s marketing
cmod:failed to get attributes of marketing' :No such file or directory
Kindly guide me about the error message and can I solve it ?
Thanks in advance,
gardena
 
Old 02-24-2011, 05:45 AM   #2
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 610

Original Poster
Rep: Reputation: 31
Well I have solve the issue.I added the sticky bit to a directory.
 
Old 02-24-2011, 10:00 AM   #3
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,362

Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by gardenair View Post
Well I have solve the issue.I added the sticky bit to a directory.
Yes permission and special permissions are applied to files but access controls are applied to users and groups.
 
Old 02-25-2011, 02:23 AM   #4
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 610

Original Poster
Rep: Reputation: 31
thanks all for your guidance.Well on dir it is working perfect. I want to know regarding to octal value. Normally we do chmod g+s dir_name.When we say I it is said sticky bit .So which one sticky bit it .For root user ? Please guide me.It is confusing me!

2- When the default directory permission is 755 and we want to add sticky bit we should add it as

Code:
#chmod 2755 dir_name
and to remove sticky bit
Code:
#chmod 0755 dir_name
Kindly guide me about how to remove sticky bit using Octal digit.

3- In some web sites i have learned that to add or remove the sticky bit, use chmod with the "t" flag:
chmod +t <directory>
chmod -t <directory>
so when the +t will apply it will on normal user or for root user ?




Following are some Numeric representation for your kind info.
Octal digit Binary value Meaning
0 000 setuid, setgid, sticky bits are cleared
1 001 sticky bit is set
2 010 setgid bit is set
3 011 setgid and sticky bits are set
4 100 setuid bit is set
5 101 setuid and sticky bits are set
6 110 setuid and setgid bits are set
7 111 setuid, setgid, sticky bits are set

Last edited by gardenair; 02-25-2011 at 04:21 AM.
 
Old 02-25-2011, 06:32 AM   #5
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,362

Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by gardenair View Post
thanks all for your guidance.Well on dir it is working perfect. I want to know regarding to octal value. Normally we do chmod g+s dir_name.When we say I it is said sticky bit .So which one sticky bit it .For root user ? Please guide me.It is confusing me!

2- When the default directory permission is 755 and we want to add sticky bit we should add it as

Code:
#chmod 2755 dir_name
and to remove sticky bit
Code:
#chmod 0755 dir_name
Kindly guide me about how to remove sticky bit using Octal digit.

3- In some web sites i have learned that to add or remove the sticky bit, use chmod with the "t" flag:
chmod +t <directory>
chmod -t <directory>
so when the +t will apply it will on normal user or for root user ?




Following are some Numeric representation for your kind info.
Octal digit Binary value Meaning
0 000 setuid, setgid, sticky bits are cleared
1 001 sticky bit is set
2 010 setgid bit is set
3 011 setgid and sticky bits are set
4 100 setuid bit is set
5 101 setuid and sticky bits are set
6 110 setuid and setgid bits are set
7 111 setuid, setgid, sticky bits are set
suid is applied to x bit of userowner(u)
sgid is applied to x bit of groupowner(g)
stickybit is applied to x bit of otherowner(o)

where x is execute bit.

You have already mentioned, if you run chmod 0755 , all the special permission will be removed.

suid has value 4
sgid has value 2
stickybit has value 1

So if any file has permission of 755, to apply sticky bit just: chmod 1755 <file name>
and to remove just run chmod 0755 <filename>

similar apply to suid and sgid.

And you can apply any combinations to make the values as in your table.

Last edited by divyashree; 02-25-2011 at 06:47 AM.
 
Old 02-25-2011, 06:53 AM   #6
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 610

Original Poster
Rep: Reputation: 31
thnaks for reply. well as you mentioned that

suid has value 4
sgid has value 2
stickybit has value 1

so the value 1 represent for sticky bit and that sticky bit goes to other ? like user,group and others ?
just explain a little bit more .
should be thankful to you
garden
 
Old 02-25-2011, 07:21 AM   #7
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,362

Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by gardenair View Post
thnaks for reply. well as you mentioned that

suid has value 4
sgid has value 2
stickybit has value 1

so the value 1 represent for sticky bit and that sticky bit goes to other ? like user,group and others ?
just explain a little bit more .
should be thankful to you
garden
Yes sticky bit goes to exeucte bit of the other.

you can check what is changed in permission bit,

PHP Code:
ls -<file-name
run this before applying sticky and after applying sticky.

You can see the difference. and post what the difference you found.
 
  


Reply


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
Sticky situation bcos of sticky bit Voyager7 Linux - Newbie 4 03-01-2011 12:29 AM
sticky bit lipun4u Linux - Newbie 8 02-28-2010 05:17 PM
group permission the sticky bit permission comes in capital 'S' pkishorenayak Linux - Newbie 1 04-11-2008 06:04 PM
About Sticky bit... masudur_iiu General 4 09-13-2006 11:23 AM
Enable sticky mouse keys mib_ths Linux - Software 0 01-01-2005 10:29 AM


All times are GMT -5. The time now is 10:24 AM.

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