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 - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 05-22-2010, 09:41 AM   #1
terrytibbs
Member
 
Registered: Jul 2009
Distribution: Solaris (SCSA), Red Hat (RHCT)
Posts: 47

Rep: Reputation: 16
Quick sudo question


Can you set a user to su to another user without a password?

ie, I am logged in as userA I want to su to userB without a password,

A colleague is suggesting NOPASSWD in sudoers file, but this just stops you having to enter userA's password, no userB's password?

Any help would be appreciated.

Ta
 
Old 05-22-2010, 09:47 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

You could use su - to go assume root rights which will ask you for your password (if you're in the sudoers list). From there you can su to any user without having to type the password.

It's also pretty insecure to assume that level of 'user hopping' when you're not root. One user shouldn't be allowed to switch to another user like that, better is to set permissions on file level.

Kind regards,

Eric
 
Old 05-22-2010, 09:49 AM   #3
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
You colleague is correct, add something like the following to /etc/sudoers:

Code:
userA   ALL=(ALL) NOPASSWD: /bin/su - userB
Then you use the command:

Code:
sudo su - userB
@EricTRA: we see this pretty often where users need to su to a service account, like 'oracle'

cheers

Last edited by kbp; 05-22-2010 at 09:52 AM.
 
1 members found this post helpful.
Old 05-22-2010, 10:02 AM   #4
terrytibbs
Member
 
Registered: Jul 2009
Distribution: Solaris (SCSA), Red Hat (RHCT)
Posts: 47

Original Poster
Rep: Reputation: 16
Thanks guys.
 
Old 05-22-2010, 10:06 AM   #5
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Quote:
Originally Posted by kbp View Post
You colleague is correct, add something like the following to /etc/sudoers:

Code:
userA   ALL=(ALL) NOPASSWD: /bin/su - userB
Then you use the command:

Code:
sudo su - userB
@EricTRA: we see this pretty often where users need to su to a service account, like 'oracle'

cheers
Hello,

Thanks for the info; of course you're right. I didn't think that far since we don't have our users connecting on Linux level.

Kind regards,

Eric
 
  


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
LXer: The Ultimate Sudo FAQ — To Sudo Or Not To Sudo? LXer Syndicated Linux News 13 04-13-2013 01:36 AM
LXer: sudo, or not sudo: that is the question LXer Syndicated Linux News 0 02-07-2008 05:40 PM
LXer: Quick how-to sudoers file (sudo command) LXer Syndicated Linux News 0 11-25-2007 01:50 AM
Restricting Editing in Sudo (Advanced Sudo Question) LinuxGeek Linux - Software 4 11-04-2006 03:20 PM
Quick Question About Sudo HappyDude Linux - Security 5 06-09-2004 12:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:59 PM.

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