Unix administration - sudo as another user without password prompt

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > November 2004 > sudo as another user without password prompt





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author sudo as another user without password prompt
Mike Davies

2004-11-13, 5:48 pm

I've never used sudo before. I would like to be able to issue a command
(whoami for this example) as user "nbadmin" and have it run as user "nz"
without being prompted for a password.

Here's my entry in /etc/sudoers:

nbadmin platinum=(nz) /usr/bin/whoami

I get prompted for a password as follows:

[nbadmin@platinum nbadmin]$ sudo -u nz whoami
Password:
nz

It is important that the command is run as user "nz" and not as root.

Any ideas?

Mike


T.A.

2004-11-13, 5:48 pm

On 2004-11-13, Mike Davies <michaelsdavies@yahoo.co.uk> wrote:
> I've never used sudo before. I would like to be able to issue a command
> (whoami for this example) as user "nbadmin" and have it run as user "nz"
> without being prompted for a password.
>
> Here's my entry in /etc/sudoers:
>
> nbadmin platinum=(nz) /usr/bin/whoami
>
> I get prompted for a password as follows:
>
> [nbadmin@platinum nbadmin]$ sudo -u nz whoami
> Password:
> nz
>
> It is important that the command is run as user "nz" and not as root.
>
> Any ideas?
>
> Mike
>

Man sudo. There are options for sudo users that allow
no password, not to mention specifying commands.

Rodrick Brown

2004-11-14, 2:46 am

On 2004-11-13 15:08:40 -0500, "Mike Davies" <michaelsdavies@yahoo.co.uk> said:

> I've never used sudo before. I would like to be able to issue a command
> (whoami for this example) as user "nbadmin" and have it run as user
> "nz" without being prompted for a password.
>
> Here's my entry in /etc/sudoers:
>
> nbadmin platinum=(nz) /usr/bin/whoami
>
> I get prompted for a password as follows:
>
> [nbadmin@platinum nbadmin]$ sudo -u nz whoami
> Password:
> nz
>
> It is important that the command is run as user "nz" and not as root.
>
> Any ideas?
>
> Mike


This feature is documented in the sudo man pages you need to use the
NOPASSWD keyword in your sudoers file.

--
Unix Systems Engineer
The City of New York
Dept. of Information Technology
http://www.nyc.gov/doitt
rbrown[(@)]doitt.nyc.gov
http://www.rodrickbrown.com

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com