I've set up sudo not to prompt for password by editing the sudoers file:
myuser ALL=(ALL:ALL) NOPASSWD: ALL
And it works fine, running sudo with no password prompting. But when entering sudo -v I noticed that it prompted for password, only once.
In /usr/local/bin I've the following script called sdown
/usr/local/bin$ cat sdown
#!/bin/bash
if [ $# -lt 1 ];
then
echo "no time set"
else
sudo shutdown -h $1
fi
Permssions are 788: -rwxr-xr-- user user sdown
The point is if I run the script it's prompting for the sudo password:
/usr/local/bin$ sdown 13:37
[sudo] password for user:
Just to make my life even better I'd like to avoid
I visudoed sudoers to allow a user to run one bash script with a passwordless sudo, which works fine when logged in (also via SSH). However, when I log in via SSH using public key authentication and configure authorized_keys' command="sudo myScript", I am promped for the user password by sudo. Having the script itself use sudo on another program does however work without requiring a password.
I currently use a script which contains commands along the lines of
sudo /sbin/mount.cifs $SERVER_SHARE $MOUNT -o username=$DOMAIN_$USER,uid=$USER,gid=$USER,file_mode=0664,dir_mode=0775
to mount my cifs shared directories.
A PHP program I am working with (LConf) calls a script using sudo.
I have allowed the user apache to run the script and have tested with sudo -u apache /usr/local/LConf/lconf_deploy.sh.
I am being prompted for a password when lconf_deploy.sh calls /usr/bin/sudo -u icinga /usr/local/LConf/LConfExport.pl -o /etc/icinga/lconf -v, but have no problems calling lines before or after this line.
After
I have a script run from a non-privaleged users' crontab that invokes some commands using sudo. Except it doesn't. The script runs fine but the sudo'ed commands silently fail.
The script runs perfectly from a shell as the user in question.
Sudo does not require a password. The user in question has (root) NOPASSWD: ALL access granted in /etc/sudoers.
Cron is running and executing the script.
I have two users on my system: itsadok, my main user, and elasticsearch, a user with a different ulimit for running ElasticSearch.
I would like to be able to run stuff as the secondary user without being prompted for password every time.
hi,
i have a requirement where i need to sudo to another user in the shell script.suppose consider user A and B, first user A calls a shell script and then i need to sudo to user B which executes another shell script inside the earlier one.
also this needs to be automated like while sudo'ing to user B it should not ask for password prompt, password should be read from some file or by any other mea
I am trying to manage Unix users with puppet. Puppet provides enough tools to create accounts and provide authorized_keys files for instance, but no to set up user password, and it tell to the user.
What I have done is a python script which generate a random password and send it to the user by email.