LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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: 539

Rep: Reputation: 33
'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: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
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: 539

Original Poster
Rep: Reputation: 33
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: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

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

Original Poster
Rep: Reputation: 33
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: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
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: OpenBSD / Debian / Ubuntu / Win7 / OpenVMS
Posts: 440

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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:28 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration