LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   'user' not in the sudoers file (http://www.linuxquestions.org/questions/linux-software-2/user-not-in-the-sudoers-file-882447/)

thomas2004ch 05-24-2011 08:56 AM

'user' not in the sudoers file
 
Hi,

As I try to run
Code:

sudo /bin/su -lc .....
I got error that
Code:

'user' not in the sudoers file
How can I configure the /etc/sudoers file?

-- Thomas

TobiSGD 05-24-2011 09:07 AM

You don't need sudo to run su. Just omit the sudo.

thomas2004ch 05-24-2011 09:14 AM

But from another machine I see in the sudores file followings:

Code:

...
User_Alias GHOST = svc_opalis_01
Cmnd_Alias SU = /bin/su
GHOST ALL=NOPASSWD:SU
...

But I don't know what are the effect of these.

TobiSGD 05-24-2011 09:17 AM

Read
Code:

man sudoers

thomas2004ch 05-24-2011 09:19 AM

Quote:

Originally Posted by TobiSGD (Post 4365637)
You don't need sudo to run su. Just omit the sudo.

You are right.

But I will run the /bin/su not manually but from a script. Since I will be asked for the password by running /bin/su and the script can not automatically input the password, so I have to set the 'user' in /bin/sudores.

TobiSGD 05-24-2011 09:24 AM

Didn't thought about that. Setting up sudo to run su without a password is a real security risk, the user that is allowed to do that is practically root, be aware of that.

MBybee 05-24-2011 10:20 AM

You can su in a script - we do it here all the time.
You do have to run the script as a user who can su without password, however (or use Expect).

An easy way to do the same basic thing without running as root is to use ssh with passwordless login (via keys). Then just have the script call "ssh user@host command"


All times are GMT -5. The time now is 05:59 AM.