Computing.Net > Forums > Unix > The SETUID bit

The SETUID bit

Reply to Message Icon

Original Message
Name: vicchai
Date: July 16, 2005 at 08:42:14 Pacific
Subject: The SETUID bit
OS: HP-UX
CPU/Ram: Nil
Comment:

I read from a book says: "if the SETUID bit of a file is set, it runs as the owner of the file when ever executed by any user." So I login as root user and create a script named io_scan.sh, I have change the SETUID like this: chmod 4555 io_scan.sh but I still cannot run this script using other user except root. Can any one tell me what mistake I have made?

The contain of the io_scan.sh:
date >> /tmp/io_scan.txt
ioscan -fnC disk >> /tmp/io_scan.txt

When I do a long list of the two files:
ll /bin/io_scan.sh
-r-sr-xr-x 1 root bin 10 Jul 16 10:40 /bin/io_scan.sh

ll /tmp/io_scan.txt
-rw-r--r-- 1 root root 12 Jul 16 10:55 /tmp/io_scan.txt

Thanks for any help.


Report Offensive Message For Removal


Response Number 1
Name: gurubit
Date: July 19, 2005 at 03:43:41 Pacific
Subject: The SETUID bit
Reply: (edit)

I guess the mistake that you have made is you have set the permission using root. So, now root becomes the owner of the file and any file on which root is the owner should not be executed by any other.

I tried it with other user and it worked.
It executed the process as the owner of the file and not the logged in user.


Report Offensive Follow Up For Removal

Response Number 2
Name: vicchai
Date: July 19, 2005 at 06:15:15 Pacific
Subject: The SETUID bit
Reply: (edit)

Hi Rajesh,

Thanks for the reply.

I have tried set the script with other user, inside the script there is a while loop and only one command whoami, I login with other user and run that script, the whoami return the logged in user, not the owner of the script, I grep the process and is run by the logged in user too. Can you tell me what you have tried? Please...


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: The SETUID bit

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge