I'm not trying to delete my password or anything. I just want ubuntu to remember my password after I login as an admin user and use that when installing/removing software or running sudo commands. The non-admin users should be prompt for the admin password though. Is there a way to do that and if so why doesn't ubuntu do that as default?
There's no such thing as "an admin password" in Ubuntu. Any user can elevate his privileges by using sudo as long as that is available to him. And by default
sudo requires you to re-authenticate for security reasons. This is a sane default for this reasons as it fits with the "secure by default" policy.
However, it does remember it for a short period of time. Here's a question on how: How does sudo remember you already entered root's password?
Several options to go from here:
From the manpage of
sudorequires that a user authenticate him or herself before running a command. This behavior can be modified via the
Just change the lines in
/etc/sudoersto include this. E.g.:
%admin ALL=(ALL) ALL %sudo ALL=(ALL:ALL) ALL
%admin ALL=(ALL) NOPASSWD: ALL %sudo ALL=(ALL:ALL) NOPASSWD: ALL
sudowill "remember" your password to elevate your privileges again for fifteen minutes. You can extend this to a much longer time, let's say a day. Do note that this is not unlocked on login, but only triggered the first time you are elevating your privileges.
To extend this, edit the
/etc/sudoersfile and locate the line
,timestamp_timeout=1440to it so it becomes
-1(a negative value) to have a really indefinite timeout. Read more about this on the Ubuntu Community wiki: RootSudoTimeout.
Important note! Editing the
/etc/sudoers file should be done with great care. Incorrect syntax will result in a system on which you are probably not be able to elevate your privileges again and you'll have to perform a rather complicated password recovery. To edit it safely, use the
sudo visudo command in the terminal. It will not directly write to the file, but only when you exit and save it and the syntax is correct. This will prevent a lot of trouble.