Friday, April 17, 2015

How To Add User To Sudoer File Without A password


I want to have a user have sudo access without needing a password, so I did this.


sudo vi /etc/sudoers

Set this up:

# Members of the admin group may gain root privileges
%admin  ALL=(ALL) NOPASSWD:ALL
sudo service sudo restart
sudo adduser  sudo

How To Add A New SSH Key To A Ubuntu Server


HOW TO ADD AN SSH KEY LIKE A DUMMY:

So if you have a client machine and you want to give them access to your server do this.
ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/client/.ssh/id_rsa): /Users/client/.ssh/new_key
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/client/.ssh/new_key.
Your public key has been saved in /Users/client/.ssh/new_key.pub.

This generates two files:
/Users/client/.ssh/new_key        (private)
/Users/client/.ssh/new_key.pub (public)
Now you must copy the public key to the server of interest. On the server after you have copied the local file you can append to the 
cat /home/john/new_key.pub >> /home/john/.ssh/authorized_keys
Now the user can login using their private key.
ssh -i /Users/client/.ssh/new_key john@myserver.com