The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Processes by User's names kartikkumar84@g UNIX for Dummies Questions & Answers 2 05-22-2008 01:59 PM
ps results - to show user's ps only rdns UNIX for Dummies Questions & Answers 13 10-15-2007 01:36 PM
user's right iwbasts SUN Solaris 2 06-08-2006 12:54 AM
Auditing User's actions Timberland HP-UX 3 01-28-2006 09:53 AM
tracing a user's session hmaiida HP-UX 2 11-27-2004 09:48 AM

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 01-17-2007
srikanthus2002's Avatar
srikanthus2002 srikanthus2002 is offline
Registered User
  
 

Join Date: Sep 2006
Location: Can u guess...!
Posts: 160
series of programes which are to be executed in other user's permissions

I have series of programe which are to be executed in other user's permissions.

ex :
1. Two programes : programe1 and programe2.
2. Logged into the server as a user say "sri"
3. If I execute the programes system shows with "sri" owner.

sri ohter programe1
sri other programe2

4. I have sudo permissions, if I run with sudo system shows "root"

5. But i want to take the permission as "kanth" (which is other user)

can i user any command like "su" with parameter

Any help would be greatly appreciated.
  #2 (permalink)  
Old 01-17-2007
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
This should be possible. See man su


Code:
su -l kanth -c "programe1"

  #3 (permalink)  
Old 01-17-2007
grial's Avatar
grial grial is offline Forum Advisor  
El UNIX es como un toro
  
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
Another way: You may set the SUID bit to those programs, owned by the user you want them to be run as. So, if you have programe1 and programe2, and want them to be run as user1 then:

Code:
user2> ls -l programe1 programe2
-rwsr-xr-x   1 user1     user1            0 Jan 17 11:26 programe1
-rwsr-xr-x   1 user1     user1            0 Jan 17 11:26 programe2
user2> ./programe1

I do not kike to use SUID unless it's necessary, but it's a possible and easy solution.
  #4 (permalink)  
Old 01-17-2007
srikanthus2002's Avatar
srikanthus2002 srikanthus2002 is offline
Registered User
  
 

Join Date: Sep 2006
Location: Can u guess...!
Posts: 160
Dear vino,

su -1 "kanth" -c "programe1" this options is not working as system gives an error "usage: su [ - ] user [sh options]"

Dear griel

SUID can not be set becasue all are application related programe.
  #5 (permalink)  
Old 01-17-2007
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
Quote:
Originally Posted by srikanthus2002
Dear vino,

su -1 "kanth" -c "programe1" this options is not working as system gives an error "usage: su [ - ] user [sh options]"
the l in -l is the alphabet l (el) and not the digit 1
  #6 (permalink)  
Old 01-17-2007
srikanthus2002's Avatar
srikanthus2002 srikanthus2002 is offline
Registered User
  
 

Join Date: Sep 2006
Location: Can u guess...!
Posts: 160
yes i tried with both the option "1 and l"


Code:
su -l kanth -c "programe1" which gives "usage: su [ - ] user [sh options]"

error.

i tried with

Code:
su kanth -lc "programe1" which asks password ( which i don't know)

pls help me out on this
  #7 (permalink)  
Old 01-17-2007
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
Quote:
Originally Posted by srikanthus2002
yes i tried with both the option "1 and l"


Code:
su -l kanth -c "programe1" which gives "usage: su [ - ] user [sh options]"

error.
Post the output of uname -a
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:06 AM.


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