series of programes which are to be executed in other user's permissions


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting series of programes which are to be executed in other user's permissions
# 1  
Old 01-17-2007
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  
Old 01-17-2007
This should be possible. See man su

Code:
su -l kanth -c "programe1"

# 3  
Old 01-17-2007
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  
Old 01-17-2007
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  
Old 01-17-2007
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  
Old 01-17-2007
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  
Old 01-17-2007
Quote:
Originally Posted by vino
the l in -l is the alphabet l (el) and not the digit 1
Anyway,
Code:
su - kanth -c "programe1"

(without "-l") is enough for my su...
Quote:
Originally Posted by srikanthus2002
SUID can not be set becasue all are application related programe.
Why? You just need to change the owner and set the bit... Perhaps you mean you don't have the possibility to do this, right?
Regards.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Find Original user who executed the command

Hi Team, Please help me with the below question. SunOS 5.10 Shell: -bash I am trying to find the original user who executed a command on my development server. In my dev server users login using their personal id and sudo to a common id using 'sudo -u commonid -i'. Once logged in as... (6 Replies)
Discussion started by: sam99
6 Replies

2. HP-UX

Tracking what commands were executed after sudo to another user

All team members has sudo access to user "batch55". Need to track all the commands used by team members after sudo to "batch55". Using HP-UX and ksh shell in our environment. How can i acheive this? Thanks In Advance. (2 Replies)
Discussion started by: venkatababu
2 Replies

3. Shell Programming and Scripting

Find logon user based on executed script proc id

Hi, i have requirement to find logged in user based on process id. i have below scenario. 1. all my users will logon to unix box using ssh from windows system. 2. after successful logon they will sudo to common user. ex. sudo -su edadm lot of users are executing jobs from edadm user and... (2 Replies)
Discussion started by: tmalik79
2 Replies

4. Shell Programming and Scripting

new-user permissions

Hi, i'm using a Unix machine. I login as root. when i create new users using useradd -m <user_name> their home directories will be created in /home/ directory with default permissons of 750. i.e., drwxr-x--- how can i change these default permissions..?? which file to access and what changes i... (2 Replies)
Discussion started by: sandeepyes
2 Replies

5. AIX

Script not getting executed via cron but executes when executed manually.

Hi Script not getting executed via cron but executes successfully when executed manually. Please assist cbspsap01(appuser) /app/scripts > cat restart.sh #!/bin/ksh cd /app/bin date >>logfile.out echo "Restart has been started....." >>logfile.out date >>logfile.out initfnsw -y restart... (3 Replies)
Discussion started by: samsungsamsung
3 Replies

6. UNIX for Dummies Questions & Answers

How to see a user's permissions on a directory

i know about ls, I know.... but some of our shares have a long messy list of acls and it is a lot to sort through.. without a grep option, unless you have a really nice one, is there a simple way to say: show me <USER> acl permissions on <SHARE> ? (1 Reply)
Discussion started by: glev2005
1 Replies

7. Solaris

user permissions

hi i want to display the usernames,usergroups user permissions and user home directory's with in a single command.and possibities are their for getting this output .. (9 Replies)
Discussion started by: tv.praveenkumar
9 Replies

8. Solaris

whole day commands executed by particular user

Hi all I want to know the commands executed a by particular user .. for the whole day on my machine. I have checked out with the commad $lastcomm <user> It is throwing an error called: .. /var/adm/pacct: No such file or directory Can u help me in this regard.. Thank U Naree (1 Reply)
Discussion started by: naree
1 Replies

9. Solaris

I want to know whole day commands executed by particular user

Hi all I want to know the commands executed a by particular user .. for the whole day on my machine. I have checked out with the commad $lastcomm <user> It is throwing an error called: .. /var/adm/pacct: No such file or directory Can u help me in this regard.. Thank U... (3 Replies)
Discussion started by: naree
3 Replies

10. UNIX for Advanced & Expert Users

Capturing commands executed by user

Hello Unix Champs, For keeping audit trail, I want to log the commands entered by the normal users, on their terminal into a text file. I tried putting a "script -a username.timestamp.txt" in the user profile file, but script command stops execution when user types exit or presses CTRL+D... (3 Replies)
Discussion started by: bhaven.haria
3 Replies
Login or Register to Ask a Question