LinuxQuestions.org
Review your favorite Linux distribution.
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-01-2009, 12:20 PM   #1
saagar
Member
 
Registered: Jul 2008
Location: Chennai, India
Distribution: RHEL5, Ubuntu
Posts: 191

Rep: Reputation: 37
A Question related to SUID (Set UID)


Hello Friends,
I am trying to understand the concept of SUID. According to the resources I have, when a file is given an SUID permission with executable permission to others,irrespective of the user who is executing it, the system will run with a UID number of 0 (that is root) thinking that it was run by root.

I tried to experiment with it as follows:
useradd normaluser
mkdir /public
chmod 777 /public
touch /public/script.sh
chmod 4777 /public/script.sh
vi /public/script.sh

#!/bin/bash
echo "$(whoami)"
:wq

su - normaluser
[normaluser@station1~]$cd /public
[normaluser@station1~]$./script.sh

THE OUTPUT IS : normaluser. Actually it should be root. is it not?. Please advise me on how to go about with this.

Last edited by saagar; 02-01-2009 at 12:44 PM.
 
Old 02-01-2009, 02:35 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530
setXid doesn't apply to scripts. If 'sudo' is not what you're looking for (that is, you've read some and kind of understand what it could do for you) then maybe explain what you're actually trying to accomplish?
 
Old 02-02-2009, 11:26 AM   #3
saagar
Member
 
Registered: Jul 2008
Location: Chennai, India
Distribution: RHEL5, Ubuntu
Posts: 191

Original Poster
Rep: Reputation: 37
Hi Mr.Unspawn,
I wish to know through an example how this works..(just more than the theory part). Actually, I am not clear with this concept. Thank you.
 
Old 02-03-2009, 06:21 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530
Best search LQ for it. Should be plenty examples here.
 
  


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
set uid and sticky bit question. awaiz Red Hat 5 12-08-2006 12:08 AM
passwd command is set in suid root. why??? Simon Adebisi Linux - Software 2 06-27-2005 11:02 PM
Set UID hinetvenkat Linux - Security 4 06-08-2005 04:50 AM
Home Network set up and another related question webwolf70 Linux - Networking 4 07-16-2004 12:33 AM
how to set artswrapper suid root ? chokecherry Linux - General 3 11-27-2003 04:32 AM


All times are GMT -5. The time now is 09:28 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