LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 05-24-2011, 08:56 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 490

Rep: Reputation: 31
'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
 
Old 05-24-2011, 09:07 AM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Gentoo
Posts: 15,438
Blog Entries: 2

Rep: Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001
You don't need sudo to run su. Just omit the sudo.
 
Old 05-24-2011, 09:14 AM   #3
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 490

Original Poster
Rep: Reputation: 31
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.
 
Old 05-24-2011, 09:17 AM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Gentoo
Posts: 15,438
Blog Entries: 2

Rep: Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001
Read
Code:
man sudoers
 
Old 05-24-2011, 09:19 AM   #5
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 490

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by TobiSGD View Post
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.
 
Old 05-24-2011, 09:24 AM   #6
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Gentoo
Posts: 15,438
Blog Entries: 2

Rep: Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001
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.
 
Old 05-24-2011, 10:20 AM   #7
MBybee
Member
 
Registered: Jan 2009
Location: wherever I can make a living
Distribution: PC-BSD / FreeBSD / Debian / Ubuntu / Win7 / OpenVMS
Posts: 438

Rep: Reputation: 57
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"
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User not in the sudoers file ersek Linux - Newbie 10 06-09-2009 12:35 PM
Adding a user to the sudoers file? annihilan Slackware 5 11-13-2008 04:36 PM
how a user can be added to sudoers file. afaheem1988 Linux - Newbie 5 08-10-2008 07:15 PM
user is not in the sudoers file after clean install Mark_667 Red Hat 3 02-11-2008 11:16 AM
Debian user not in sudoers file... phantom_cyph Linux - General 3 04-08-2007 01:08 PM


All times are GMT -5. The time now is 02:31 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration