LinuxQuestions.org
Help answer threads with 0 replies.
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-10-2009, 11:15 AM   #1
saagar
Member
 
Registered: Jul 2008
Location: Chennai, India
Distribution: RHEL5, Ubuntu
Posts: 191

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


Friends,

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

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

Code:
#su - normaluser
[normaluser@linux1~]$cd /
[normaluser@linux1~]$./script.sh
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
cantab
Member
 
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
jschiwal
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
saagar
Member
 
Registered: Jul 2008
Location: Chennai, India
Distribution: RHEL5, Ubuntu
Posts: 191

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


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:57 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
Open Source Consulting | Domain Registration