Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

understanding the suid bit

Status
Not open for further replies.

bobbybobbertson

Programmer
Nov 9, 2001
119
US
I'm trying to understand the suid bit. I want a group to be able to run a script with the permissions of the owner.

I have a script called test.pl with the following permissions:

-rwxr-sr-x 1 bob home 45 Dec 4 13:37 test.pl

When I try to run this as jim, I get:
%jim: ./test.pl
Can't do setuid

Why cat jim run this script. Both bob and jim are in the same group 'home'
 
Hi,

In general linux ignores those bits - see -->
With perl you can do it if you use the -s flag on the #! line inside the script :

#!/usr/bin/perl -s

Setuid is used to run with the owner's permissions :

chmod 4755 test.pl

-rws--x--x 1 bob home 45 Dec 4 13:37 test.pl

The way you have it above is with group id which is really used to ensure that everything in a directory retains the group id of the directory irrespective of who created it.

Regards
 
Hi,



Actually it should have been -s -T -U but I have to say I can't seem to get it to work either. It may be the way that redhat built the perl rpm. I'll let you know if I crack it...



If you want to run something as a regular user with root's (or anyone else's) permissions it might be better and more secure to use 'sudo' instead. See 'man sudo' .



Regards
 
i don't have 'sudo' for some reason. i have red hat. does that come with red hat?>
 
Hi,





Yes sudo is supplied by redhat in a rpm of the same name. Maybe you never installed it. I don't know what version of redhat you have but you should be able to use one of these :




ftp://rpmfind.net/linux/redhat/7.2/en/os/i386/RedHat/RPMS/sudo-1.6.3p7-2.i386.rpm


(7.2)


ftp://rpmfind.net/linux/redhat/7.1/en/os/i386/RedHat/RPMS/sudo-1.6.3p6-1.i386.rpm


(7.1)


ftp://rpmfind.net/linux/redhat/updates/7.0/en/os/i386/sudo-1.6.3p6-1.i386.rpm


(7.0)


ftp://rpmfind.net/linux/redhat/6.2/en/powertools/i386/i386/sudo-1.6.1-1.i386.rpm


(6.2)





Just download somewhere and install as root with :





rpm -Uvh sudo*.rpm





The sudo home page is here --> .





Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top