The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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
chown BG_JrAdmin UNIX for Dummies Questions & Answers 2 04-17-2009 09:22 AM
chown ariec AIX 2 08-14-2007 05:24 PM
Setuid Program with (-rwsr-sr-x 1 root other ) UID/EUID issue 0ktalmagik UNIX for Advanced & Expert Users 7 08-20-2006 01:16 AM
chown doesn't work shriashishpatil UNIX for Advanced & Expert Users 10 03-07-2006 02:12 PM
chown and NIS Jody UNIX for Dummies Questions & Answers 2 07-01-2003 03:57 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-01-2005
johnmsucpe johnmsucpe is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 2
Setuid root and chown

I am trying to run chown and chmod from a script owned by root. The permissions are set to 4755 so that users can execute the script as root. However, when I run the script as a user other than root, I get "Operation not permitted" for both chown and chmod. Any ideas as to why this is?
  #2 (permalink)  
Old 04-01-2005
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,240
setuid doesn't usually work with scripts it's a security feature, if you check you will find that the script does not run as root.

You will need a biary wrapper to allow you to do that, or possibly you could do it with Perl.

Last edited by reborg; 04-01-2005 at 09:07 PM..
  #3 (permalink)  
Old 04-01-2005
Just Ice's Avatar
Just Ice Just Ice is offline Forum Advisor  
Lights on, brain off.
  
 

Join Date: Mar 2005
Location: in front of my computer
Posts: 637
Quote:
Originally Posted by reborg
setuid doesn't usually work with scripts it's a security feature, if you check you will find that the script does not run as root.

You will need a biary wrapper to allow you to do that, or possibly you could do it with Perl.
i actually just tested a quick script on solaris 9 with suid bit set and it does work ...

Code:
$ id
uid=1001(otto) gid=10(staff)
$ ls -l test
-rwsr-xr-x   1 root     other         61 Apr  1 19:05 test
$ cat test
#! /bin/ksh
chown otto joke
chmod 444 joke
ls -l joke
exit 0
$ ./test
-r--r--r--   1 otto     other        568 Apr  1 17:36 joke
$ ls -l
total 64
-r--r--r--   1 otto     other        568 Apr  1 17:36 joke
-rwsr-xr-x   1 root     other         61 Apr  1 19:05 test
$

  #4 (permalink)  
Old 04-01-2005
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,240
Quote:
Originally Posted by Just Ice
i actually just tested a quick script on solaris 9 with suid bit set and it does work ...

Code:
$ id
uid=1001(otto) gid=10(staff)
$ ls -l test
-rwsr-xr-x   1 root     other         61 Apr  1 19:05 test
$ cat test
#! /bin/ksh
chown otto joke
chmod 444 joke
ls -l joke
exit 0
$ ./test
-r--r--r--   1 otto     other        568 Apr  1 17:36 joke
$ ls -l
total 64
-r--r--r--   1 otto     other        568 Apr  1 17:36 joke
-rwsr-xr-x   1 root     other         61 Apr  1 19:05 test
$
But who was joke originally owned by?

Only kidding it did work for me too on Solaris 9, but I was pretty sure it shouldn't.

Last edited by reborg; 04-01-2005 at 09:57 PM..
  #5 (permalink)  
Old 04-02-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,126
See this post.
  #6 (permalink)  
Old 04-02-2005
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,240
Thanks Perderabo, I stand enlightened.
  #7 (permalink)  
Old 04-01-2005
Just Ice's Avatar
Just Ice Just Ice is offline Forum Advisor  
Lights on, brain off.
  
 

Join Date: Mar 2005
Location: in front of my computer
Posts: 637
make sure that you're not running the script on a mounted filesystem that has the "nosuid" bit on ...
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:29 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0