Run sudo to another user


 
Thread Tools Search this Thread
Operating Systems AIX Run sudo to another user
# 8  
Old 03-30-2010
No sudo expert here but do use it and I was thinking that the % sign in front of a value was to allow everyone in that group to execute the command. You said you have two different users not two different groups. Maybe it works the same for users as well so I may be off base here and if so I apologize for mudding up the water evern worse.

I would expect to see something like

User_Alias APPUSER=appuser
Cmnd_Alias APP = /usr/app.sh
APPUSER ALL= PASSWD: APP
# 9  
Old 03-30-2010
I am no expert, but try this

$ sudo su - appusr /bin/app.sh
# 10  
Old 03-31-2010
What is the exact output of sudo -l for the user in question?

And what happens if you run:
Code:
sudo -u appadmin /usr/app.sh

With the original config of sudo that you had.
# 11  
Old 03-31-2010
Many thanks it's working

Last edited by Mr.AIX; 03-31-2010 at 06:31 AM..
# 12  
Old 06-06-2010
Dont give shell to users.

As system admin i decided not to give shell access to users and even application admins on production systems.
I give them access via a simple webpage and the menus are suid capable.
So, even root commands can be granted to someones menu.
I like the fact that no commandline trying or messups are possible.

Fjd.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to automatically run commands after SSH and SUDO not working?

I'm working on a script to SSH and SUDO as (sap user sidadm) then automatically run commands that the sidadm user can run such as R3trans -v, tp, etc.. I can SSH without password and SUDO.. but the commands don't run after I SSH and SUDO to the sidadm user...here is the commands that I've... (2 Replies)
Discussion started by: icemanj
2 Replies

2. Shell Programming and Scripting

Preserving variable in script run with sudo

In a nutshell, I want $USER to reflect my user ID in a script run with sudo. I'm working with OSX in case that makes a difference. If I 'sudo echo $USER', I get my user ID. But if I 'sudo myscript.sh' and myscript.sh has a line to echo $USER, I get 'root' I'm hoping there's a switch I can add... (1 Reply)
Discussion started by: jnojr
1 Replies

3. Shell Programming and Scripting

Chmod working in sudo run script but chown isn't

My git user has permission in sudoers to run a wrapper script to move files into my webroot. Everything is working fine except for the chown line. After the script has run, the files ar still root:root instead of apache:apache. Scratching my head...:confused: #!/bin/sh echo echo "****... (4 Replies)
Discussion started by: dheian
4 Replies

4. Shell Programming and Scripting

How to run sudo commands under a script?

Hi, I am new to scripting. I am trying to write a script to ssh one remote machine and run a sudo command. ssh <hostname> sudo -S <command> < ~/pass.txt I am stored my password in pass.txt. I am getting error sudo: no tty present and no askpass program specified Please suggest me how can... (1 Reply)
Discussion started by: venkia9
1 Replies

5. Shell Programming and Scripting

sudo: sorry, you must have a tty to run sudo

Hi, Have a need to run the below command as a "karuser" from a java class which will is running as "root" user. When we are trying to run the below command from java code getting the below error. Command: sudo -u karuser -s /bin/bash /bank/karunix/bin/build_cycles.sh Error: sudo: sorry,... (8 Replies)
Discussion started by: Satyak
8 Replies

6. AIX

track commands run as root after sudo

I'm looking for a way to track commands that are run as root after a user runs sudo su - root. I have a profile set up for root that will track the commands by userid but if we change the shell it only stores it in that shells history file. (2 Replies)
Discussion started by: toor13
2 Replies

7. Shell Programming and Scripting

sudo: sorry, you must have a tty to run sudo

Hi All, I running a unix command using sudo option inside shell script. Its working well. But in crontab the same command is not working and its throwing "sudo: sorry, you must have a tty to run sudo". I do not have root permission to add or change settings for my userid. I can not even ask... (9 Replies)
Discussion started by: Apple1221
9 Replies

8. Cybersecurity

Unable to run 'su' and 'sudo' after changing permissions on /etc

Hello, I'm running rhel6 64bit. Accidentally I ran % chmod -R 777 /etc and after that I have a problem to do 'su' or 'sudo'. When I did sudo it complained that /etc/sudoers has 777 while it should be 0440. I changed that and also restored right permission for: -rw-r--r-- 1 root root 1966 May 19... (2 Replies)
Discussion started by: susja
2 Replies

9. UNIX for Dummies Questions & Answers

sudo user

I am trying to run a command from different user on my server. However when i execute the command it asks for password can you please help. when i use this command to switch user no password is required 1) sudo su - bilbtf42 when i use 2) sudo su - bilbtf42 cp file1 direcotry1/file1 ... (3 Replies)
Discussion started by: blackeyed
3 Replies

10. UNIX for Dummies Questions & Answers

sudo not allow User to run sed

Hello, As recommended by the moderators I will start my questions here... I am a little confused by my Linux (CentOS/RHEL) distribution's sudo mechanism. Or perhaps I just do not know how to use sudo. I can run a sed command as the root user but it fails to write a root-owned directory... (6 Replies)
Discussion started by: duderonomy
6 Replies
Login or Register to Ask a Question