Problem using sudo with NOPASSWD


Thread Tools Search this Thread
# 1  
Old 04-11-2016
Problem using sudo with NOPASSWD

I need to configure access for a user in an HP-UX to :

1) use certain commands and
2) login as another user as a sudo.

These have to be done WITHOUT the user needing to enter a password.

However, after I enter the lines using visudo, there is a prompt for a password when the user executes those 2 commands.

This is the line I added in visudo :

etigers   ALL = NOPASSWD: /usr/sbin/sudo su - userX, /path/to/command/to/execute

However, initially before this line was added, there were 2 other lines above it, without the NOPASSWD option. Could it be that these 2 lines were overriding this line?

Also, in the visudo file there was no !#/bin/bash at the top of the file.

Or is it that for users first time using sudo, there will be a prompt for password?

Is there a need to restart visudo service? If so, how? What command? I tried using service visudo restart but it says 'service' no such command.
# 2  
Old 04-11-2016
Wonder if ther is not something queer here...
etigers   ALL = NOPASSWD : /path/to/command/to/execute, /usr/bin/su - userX

Check the path to su as I have no more HP-UX under my hand to verify... You need to give absolute path to binaries in sudoers for sudo to work properly...
# 3  
Old 04-11-2016
Swapping places with each other still does not resolve this issue. This is the exact look of the user privilege in the visudo file.

## User privilege specification
#emokchee ALL=NOPASSWD: /usr/local/bin/lsof
etigers ALL=(ALL) NOPASSWD:/bscsbin/bscst4/lisa/product/UMOBILE/prod/bscs/bin/hpux11_ia64.x/dmh, /usr/local/bin/sudo su - bscst4
root ALL=(ALL) ALL
#%bscs ALL=(ALL) ALL
#emokchee ALL=NOPASSWD: /usr/local/bin/lsof
#etigers ALL=(ALL) NOPASSWD: /usr/local/bin/sudo su - bscst4, /bscsbin/bscst4/lisa/product/UMOBILE/prod/bscs/bin/hpux11_ia64.x/dmh

# 4  
Old 04-12-2016
You didnt copy exactly the line... And you did not give absolute path to su...

I removed /usr/local/sudo...
And the reason of inverting is I dont know what version of HP-UX you are on nor do we know which sudo, sudo behaviour cant change drastically depending on how good you know the product and compile with your custom options...

Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
LDAP - sudoers and the nopasswd flag - How can i set some commands for wheelgroup without password? darktux UNIX and Linux Applications 0 03-19-2016 11:22 AM
Problem connect to a different server then do sudo login and finally run some scripts and get result Devesh5683 Shell Programming and Scripting 2 04-21-2014 03:51 AM
sudo: sorry, you must have a tty to run sudo Satyak Shell Programming and Scripting 8 09-25-2012 08:31 AM
sudo: sorry, you must have a tty to run sudo Apple1221 Shell Programming and Scripting 9 07-31-2012 05:50 AM
ssh sudo command - Prompts for sudo password as visible text. Help? fluoborate Shell Programming and Scripting 9 11-02-2011 03:18 PM
sudo wildcards problem: for every argument a *-wildcard? Better solution? slashdotweenie UNIX for Advanced & Expert Users 2 09-20-2011 11:12 AM
sudo log and sudo auditing jalite19 AIX 3 12-08-2010 05:11 PM
Problem with Sudo inside a here document mnanavati UNIX for Dummies Questions & Answers 0 11-12-2010 04:23 PM
Problem with password expire and sudo. sparcman Solaris 2 04-14-2010 02:18 PM
Sudo Problem? datkan Linux 1 04-08-2010 08:58 AM
Unable to use the Sudo command. "0509-130 Symbol resolution failed for sudo because:" Chloe123 UNIX for Dummies Questions & Answers 1 12-21-2009 05:09 PM
shell script problem , sudo mount command cola Shell Programming and Scripting 3 08-19-2009 03:09 PM
Switch user :NOPASSWD setting mindtee_abhi UNIX for Advanced & Expert Users 2 03-19-2009 01:03 AM
Sudo command problem mindtee_abhi UNIX for Advanced & Expert Users 4 03-17-2009 02:24 AM
problem with sudo su and .sh script cleansing_flame Shell Programming and Scripting 1 01-14-2008 03:32 PM