![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shutdown | aewpcoles | UNIX for Advanced & Expert Users | 6 | 08-03-2006 09:46 AM |
| using 'cat' to in 'while read line' | chugger06 | UNIX for Dummies Questions & Answers | 3 | 01-18-2006 02:40 PM |
| SCO 5.06 :automatic shutdown on the job? | rendechen | SCO | 1 | 01-06-2005 06:05 PM |
| non root shutdown???? | byblyk | Linux | 4 | 07-26-2004 02:01 AM |
| to shutdown | rajashekaran | UNIX for Advanced & Expert Users | 2 | 02-18-2002 01:42 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi All,
This is actually a good interview question. On linux, the permissions and group for 'shutdown' and 'cat' is the same. -rwxr-xr-x 1 root root 18K 2008-05-21 10:43 shutdown -rwxr-xr-x 1 root root 17K 2007-01-30 19:51 cat Then why is it that a normal user cannot run the 'shutdown' command ? I've done some searching and I think it has something to do with SUID. The 'shutdown' command calls the seteuid(0) where as the 'cat' command does not. Is this correct ? Could someone please verify? Also is there a list of commands which can only be run by su even though the permissions are the same? I mean how can we know? Thanks. Last edited by scottsiddharth; 11-25-2008 at 01:00 AM.. |
|
|||||
|
Since there is no SETUID bit set, as you can see yourself looking at the permissions, I think it is the binary itself checking who is executing it. If you try different binaries in /sbin as a non root user you get different output, so it seems not to be a system wide mechanism.
Here is a good explanation for SETUID bit etc., 6.2: Linux permissions |
|
||||
|
$ strace ./shutdown
execve("./shutdown", ["./shutdown"], [/* 16 vars */]) = 0 . . *****text omitted***** . getuid32() = 8218 geteuid32() = 8218 setuid32(8218) = 0 getuid32() = 8218 write(2, "shutdown: you must be root to do"..., 39shutdown: you must be root to do that! ) = 39 exit_group(1) = ? Process 6144 detached ************************************************* $ ./shutdown shutdown: you must be root to do that! Wow. Thanks dude. Never knew such a command existed even. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| linux commands |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|