[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: su to a specific system account without input password



Patrick Hsieh wrote:
Hello list,

I'd like some of the user accounts to su "mysql" without input any
password. Is it possible? How?

--
Patrick Hsieh <pahud@pahud.net>
GPG public key http://pahud.net/pubkeys/pahudatpahud.gpg

--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

You can edit /etc/sudo and make some entries in there for the users and specify which commands you want them to be able to run without authentication.  You can't edit /etc/sudo directly with vi though, you have to do it with this command visudo.  Here's a sample of what it would look like for you.
*********************************************************************
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL) ALL
[user] [hostname] = NOPASSWD: /usr/bin/foo     <--- this line sets up the user on the machine and
Defaults:[user]!authenticate     <--                                            the command to run, without a passwd.
                                                                 \--  this one tells sudo not to authenticate.
**************************************************************************************

If you want to add more commands to that user, then just seperate each one with a comma.  Like so:  /usr/bin/foo, /usr/bin/foobar.  The cool thing about visudo is that if you screw it up and make a bad entry it warns you.

Good luck.

--jason--
 

begin:vcard 
n:Schildt;Jason
x-mozilla-html:FALSE
org:LinuxNetworX;Software Development
adr:;;;;;;
version:2.1
email;internet:jschildt@linuxnetworx.com
title:Software Engineer
x-mozilla-cpt:;-6528
fn:Jason Schildt
end:vcard

Reply to: