Download your favorite Linux distribution at LQ ISO.
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 12-10-2009, 11:15 AM   #1
Registered: Jul 2008
Location: Chennai, India
Distribution: RHEL5, Ubuntu
Posts: 191

Rep: Reputation: 37
A question on SUID (Set User ID)


Suppose root user is setting a file with SUID permission and allowing others to have execute permissions as follows:

 #ls -l /
-rwsr--r-x root root ----
And then he is writing a script as follows:
#vi /
	touch /root/newfile.txt
Now, a normal user is logging in and executes that file:

#su - normaluser
[normaluser@linux1~]$cd /
touch: cannot touch `/root/newfile.txt': Permission denied
Actually, after setting SUID to a script, and if a normaluser executes that file, he should be able to write a file inside /root directory, since the effective UID is that of root user's. why is it not happening in this case? Please help.

Last edited by saagar; 12-10-2009 at 11:16 AM.
Old 12-10-2009, 11:22 AM   #2
Registered: Oct 2009
Location: England
Distribution: Kubuntu, Ubuntu, Debian, Proxmox.
Posts: 553

Rep: Reputation: 115Reputation: 115
I've a feeling SUID doesn't work for shell scripts, only for binary executables.
Old 12-10-2009, 11:29 AM   #3
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Cantab is correct. Suid isn't supported in Linux for scripts.
Old 12-10-2009, 01:51 PM   #4
Registered: Jul 2008
Location: Chennai, India
Distribution: RHEL5, Ubuntu
Posts: 191

Original Poster
Rep: Reputation: 37
cantab and jschiwal, thanks for your respnoses.


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
How to work with Set User ID (SUID)? CrAzYoNi Linux - Newbie 6 07-02-2009 02:39 AM
A Question related to SUID (Set UID) saagar Linux - Newbie 3 02-03-2009 06:21 PM
The passwd command is usually set suid root. this is because, Simon Adebisi Linux - Software 1 06-28-2005 09:10 AM
passwd command is set in suid root. why??? Simon Adebisi Linux - Software 2 06-27-2005 11:02 PM
how to set artswrapper suid root ? chokecherry Linux - General 3 11-27-2003 04:32 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:20 PM.

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
Open Source Consulting | Domain Registration