Hello.
What I want:
To be able to use sudo <cmd> without password prompt.
What I did:
This is the content of my sudoers file:
Code:
Defaults env_reset
# Uncomment to allow members of group sudo to not need a password
%sudo ALL=NOPASSWD: ALL
# User privilege specification
root ALL=(ALL) ALL
mmilic ALL=NOPASSWD: ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
I am in sudo group so i don't know why %sudo rule doesn't work.
Code:
$ id mmilic
uid=1000(mmilic) gid=1000(mmilic) groups=1000(mmilic), 1001(sudo) ....
I also don't know why user privilege spec doesn't work.
Alternatively, I tried to do the same thing with expect.My idea was to create script that will automatically put password if sudo session is over. If I call that script refresh_sudo, I would then be able to use this in my shell scripts in this way:
Code:
#!/bin/bash
refresh_sudo
sudo apt_get install $1
sudo <cmd...>
...
The exp script is:
Code:
#!/usr/bin/expect -f
spawn sudo echo session is active ?
expect {
"password" { send "mypassword\r" }
"session is active ?" {}
}
exit
and it also didn't help...
I appreciate any help.
Thanks.