setuid & sticky bit


 
Thread Tools Search this Thread
# 1  
setuid & sticky bit

Can anyone explain me difference between setuid and sticky bit? and also between setuid and chown?
# 2  
Really need to know what Operating System and version you are running because the meaning of what used to be known as the "sticky bit" has changed in modern O/S.
There is no unix command called "setuid" - it is a system call in the "C" programming language. There is however an explanation of the sticky bit in "man chmod".
There are unix command called "chmod" and "chown" and there are also system calls called "chmod" and "chown" in the "C" programming language.
Not sure whether you are looking from the point of view of a writing "C" programs or some other angle.

See:
Code:
# For "C" programming language
man 2 chmod
man 2 setuid
man 2 chown

# For unix commands
man chmod
man chown

# 3  
Quote:
Originally Posted by kkalyan
Can anyone explain me difference between setuid and sticky bit?
It's the same bit. It just has different meanings in different places.

I don't think it means anything for an ordinary file.

For an executable file, it runs the program as the file's owner -- it sets the UID with the setuid() call,, hence you sometimes hear it called "setuid bit". setuid doesn't work for shell scripts.

For a library file, it means 'remember the contents of this file in swap space', a performance tweak to keep busy libraries closer to memory. Many systems don't honor this anymore.

For directories, it means "only a file's owner is allowed to delete files in this directory". The usual behavior is that anyone with write-permissions can delete files.
Quote:
and also between setuid and chown?
setuid is a flag. chown is a program.
# 4  
setuid & sticky -- It cannot be the exact same bit.

sticky bit on a directory: chown 1777 [dirname]
No other setting really makes sense. The '1' is the sticky bit setting. Methyl is right - the sticky bit can mean different behavior in a few kinds of UNIX. The most common meaning is that, for a directory, every creator of a file in that directory is also the file
owner. /tmp is a common example.

setuid: chown 4nnn where 4 sets a regular file as setuid, and nnn is the other settings.


4 and 1 cannot be a single bit (2 & 3 are also used) since at least the number of bits required to represent 0, 1, 2, 3, 4 is required. How this is represented is filesystem dependent and OS dependent.
This User Gave Thanks to jim mcnamara For This Post:
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

What keeps me from abusing setuid(0) and programs with setuid bit set?

Just learning about the privilege escalation method provided by setuid. Correct me if I am wrong but what it does is change the uid of the current process to whatever uid I set. Right ? So what stops me from writing my own C program and calling setuid(0) within it and gaining root privileges ? ... (2 Replies)
Discussion started by: sreyan32
2 Replies

2. AIX

sticky bit

as far as i understand, if sticky bit is set on a directory, the files created under tht directory cannot be deleted by ordinary user... but we can do ths by permission itself,,, tht's assign only read permission to tht dirrectory wht 's the difference? (1 Reply)
Discussion started by: udtyuvaraj
1 Replies

3. AIX

Sticky Bit

What is sticky bit ...and where we aill use this.. how to set this bit in files and directories (1 Reply)
Discussion started by: udtyuvaraj
1 Replies

4. UNIX for Dummies Questions & Answers

Sticky Bit????

HI What is sticky bit? how can be see if the sticky bit for file is set? WHat is meaning of sticky bit set on Directory? What is the syntax to set the sticky bit? With example Thanks (10 Replies)
Discussion started by: skyineyes
10 Replies

5. UNIX for Dummies Questions & Answers

Question regarding permision and seguid bit (sticky bit)

Hi , I am having file permision as drwxrwsr_x I kwo for deleting a file in the diretory i need w permsion as well .. Say if i am having the permsion as drwxrwsrwx - wil any one can delete the files in the directory .. And one more question what is the s doing there ..... (2 Replies)
Discussion started by: arunkumar_mca
2 Replies

6. UNIX for Dummies Questions & Answers

Sticky Bit

Hi, could anyone please send me a link to learn/ know more about sticky bits? I am still not clear on the application of using a sticky bits. Thanks for your help. Regards, UP (3 Replies)
Discussion started by: teenu18
3 Replies

7. UNIX for Advanced & Expert Users

setuid sticky bit

I have a binary. It is having the following permissions rws rws rwx mqm:mqm runmqtrm The same program on another machine is rws rws rwx root: mqm runmqtrm This program is a setuid program. This is what my understanding is. Whatever user the program is started under, it will finally be... (0 Replies)
Discussion started by: bandaru
0 Replies

8. UNIX for Dummies Questions & Answers

sticky bit

What command string would you use to set the sticky bit on a directory that you own? (2 Replies)
Discussion started by: mma_buc_98
2 Replies

9. UNIX for Dummies Questions & Answers

sticky bit??

I have a script that I want to be able to let user 'wcs1234' execute it, but when it runs, it will do so under the higher authority of 'cdunix'. It is my understanding that I accomplish this with a sticky bit. I have tried every variation of this but am unable to get this to work. my script is... (2 Replies)
Discussion started by: hedrict
2 Replies

10. UNIX for Dummies Questions & Answers

Sticky bit

I have a questions, whose answer may be very obvious: Of what use is the sticky-bit permission on a Unix system? I have looked at the chmod(1) man page on our HP-UX playground system, and haven't been given much explanation: Add or delete the save-text-image-on-file- execution (sticky... (3 Replies)
Discussion started by: LivinFree
3 Replies

Featured Tech Videos