LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 12-03-2012, 01:13 AM   #1
bala.linuxtech
Member
 
Registered: Nov 2012
Location: Bangalore
Distribution: RHEL and Centos
Posts: 80

Rep: Reputation: Disabled
Sticky Bit !


HI Geeks !

Can anyone Guide me to learn Sticky bit Concepts ?

I would like to know ,

What is sticky bit ?

What is the purpose of sticky ?
 
Old 12-03-2012, 01:43 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Historically, a program with the sticky bit set would remain resident in core memory.
Now it is used for directories. Since deleting files is an operation on the directory, rather than the file inside, anyone with write access to the directory would be able to delete files inside, even if they don't own those files. The sticky bit set on a directory prevents users from deleting the files owned by someone else. It tends to be used for /tmp and external world writable directories.
 
Old 12-03-2012, 02:17 AM   #3
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
I'd add more...

Sticky Bit is a permission bit that protects the files within a directory. If the directory has sticky bit set, a file inside it can be deleted by the owner of the file, the owner of the directory or root only. This prevents a user from deleting other users files from public directories. The sticky bit is displayed as a letter t in the execute field for 'others', when we list the directory using ls or ls -ld <dir_name>. If a directory is writable and has sticky bit is set, files within directory removed or renamed only if one or more following is true:
> The user owns the file
> The user owns the directory
> The file writable by the user
> The user is root

To set it:
Code:
user@example$ chmod 1755 /path/to/dir
OR
user@example$ chmod a+t /path/to/dir
To check it:
Code:
user@example$ ls -ld /path/to/dir
drwxr-xr-t 2 user group 4096 Dec 1 16:44 /path/to/dir

Last edited by shivaa; 12-03-2012 at 02:20 AM. Reason: Info added
 
1 members found this post helpful.
Old 12-03-2012, 02:25 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
I believe its the leading '1' that denotes sticky bit, 2=sgid, 4=suid
 
1 members found this post helpful.
Old 12-03-2012, 04:16 AM   #5
kathirvel
Member
 
Registered: Jan 2011
Location: Bangalore
Distribution: RHEL,OEL
Posts: 57

Rep: Reputation: 0
Stickybit is nothing but the owner of the file can only delete the file.


Regards,
Kathirvel.S
 
Old 12-03-2012, 06:08 AM   #6
bala.linuxtech
Member
 
Registered: Nov 2012
Location: Bangalore
Distribution: RHEL and Centos
Posts: 80

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by kathirvel View Post
Stickybit is nothing but the owner of the file can only delete the file.


Regards,
Kathirvel.S


Thanks guyz ! Thanks to all !
 
Old 12-03-2012, 10:47 AM   #7
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Quote:
Stickybit is nothing but the owner of the file can only delete the file.
It's partially correct! Not only owner of the file, but root/super-user and owner of the directory can also delete/modify it. And also sticky bit works only if others do not have write permission on the file. Else others can also delete it.

Meanwhile, in many organizations, I have observed that people do not normally request for sticky bit for their large project data. But they prefer SGID.
Although sticky bit and SGID have different functions, but ultimately both are used for "protection of data" from unauthorized users.

Last edited by shivaa; 12-03-2012 at 10:53 AM. Reason: Little typo
 
  


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-bit fakie_flip Linux - Software 3 11-19-2012 06:04 PM
Sticky bit fakie_flip Linux - Software 3 10-31-2012 10:55 AM
Sticky situation bcos of sticky bit Voyager7 Linux - Newbie 4 03-01-2011 12:29 AM
About Sticky bit... masudur_iiu General 4 09-13-2006 11:23 AM
Sticky Bit tarballed Linux - General 4 07-03-2002 04:54 PM


All times are GMT -5. The time now is 12:32 PM.

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