5

Is it possible to make Ubuntu remember the password for any program after the first time it asks. I get asked for the password for Synaptic, for making a usb bootable, for connecting to the wifi network, for opening gparted and even to go to the bathroom.

Is there a way to just tell it to ask once forever or just tell it to not ask (Without going to root account. I want to keep using my own account)

1 Answer 1

7

There is also the sudo configuration file, where you can allow applications to be started without password-query. How to use it, is described here: http://www.gratisoft.us/sudo/man/1.8.0/sudoers.man.html

Warning: Though very unlikely, messing with sudoers configuration could lock you out of your system or open doors for others. Always double check and be sure of what you're doing.

As a safety precaution you can open a root shell and keep it open until you have tested your changes. Open a shell and type sudo su, you will be asked for your password. Your shell is now a root shell. Also you can make a backup of your /etc/sudoers file to be able revert changes.

The basic use is you edit it by invoking visudo in shell:

sudo select-editor # this is optional. it will allow you to select your default editor in shell
sudo visudo

The latter of wich will open your shell default editor with the file. Normal syntax is:

username machine=(usernameToRunCommandAs) command1,command2,...

as in:

confus confusion=(root) NOPASSWD:/sbin/halt,/sbin/reboot/usr/sbin/synaptic   #allows user confus to run "sudo synaptic" as root on confusion without password querry
confus ALL=(ALL) NOPASSWD:/sbin/halt,/sbin/reboot #allows confus to shutdown and reboot as all users on all machines without pw

As the $PATH variable is user dependent and sudo is not, the full path to the command is needed in sodoers list (note it says '/sbin/halt' not just 'halt'). You can find out the full path using the whereis command - as in whereis halt which will most likely return '/sbin/halt'.

Generelly speaking that's bad practise. You are asked for a reason. Installing software with synaptic ist potentially harmfull. As is tempering with partitions which can lead to an unbootable system and massive data loss. It also makes a hackers job much easier. But you're free to do it on your own risk.

2
  • 1
    For the record I know this is bad practice, but this is an interesting guide. I don't tend to be bothered by authentication requests, but if I ever do I will consult this! +1 May 20, 2011 at 2:16
  • Note: shutdown(without argument -P) is maintenance mode only! Use halt or poweroff to turn off the machine.
    – antivirtel
    Jun 12, 2011 at 21:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .