Showing posts with label password. Show all posts
Showing posts with label password. Show all posts

Thursday, October 2, 2008

Automate sudo password

I'm tired of typing my password to add new packages with Synaptic.

So, one solution is to edit the sudoers list with sudo visudo. To automate the sudo password for all programs add:
%yourgroup ALL = NOPASSWD: ALL
But this is excessive, so to automate the password for just a particular program provide its path like this:
%yourgroup ALL = NOPASSWD: /usr/sbin/synaptic

Now I can add new packages with Synaptic without being prompted for a password.

Sunday, March 30, 2008

Password protect grub

By default with Ubuntu the user can use grub to login with root privileges WITHOUT a password, which I don't feel comfortable with. This is how I password protected grub to prevent changing the boot process:

> grub
grub> md5crypt

Password: YOUR_PASSWORD
Encrypted: abcdef

grub> quit


Now copy the encrypted string into the start of the grub file:

> sudo vim /boot/grub/menu.lst
password --md5 abcdef
lock

After saving change the permissions to prevent other uses viewing the file:
> sudo chmod 600 /boot/grub/menu.lst

Saturday, March 29, 2008

Recover password

If you forget your login password it can be recovered through grub. At boot enter the grub menu and choose 'single'. This will get you a root command prompt. Now run 'passwd' to set a new password. Now anyone can do this if they get access to your machine so you should password protect grub. I will write how to do this later.

Thursday, February 28, 2008

Passwordless ssh

It becomes a hassle hopping between servers with ssh if you have to type the password each time. To enable passwordless ssh go:

> ssh-keygen -t dsa (ENTER to skip password)
> scp ~/.ssh/id_dsa.pub user@other_server

And on the other server:
> cat ~/id_dsa.pub >> ~/.ssh/authorized_keys
> rm ~/id_dsa.pub

Now you can hop between servers without a password. I only do this for servers that I can afford to be compromised.