Passwordless log is used to make sure that people can't log into your system remotely by guessing your password. Of the two, I suggest allowing as few commands as possible (first answer) rather then all commands (second answer). How to run sudo command with no password?. How do I run specific sudo commands without a password?.You configure sudo to allow you to run commands without a password. ssh -i ~/.ssh/foo 2 : Running commands via sudo without entering a password You should now be able to ssh in with your key without a password and you should not be able to ssh in as any user without a key. On the server : sudo passwd -l rootĮdit /etc/ssh/sshd_config sudo nano `/etc/ssh/sshd_config`Ĭhange the following : PasswordAuthentication no Test the key ssh -i ~/.ssh/foo it works, unset a root password and disable password login. Set a root password, use a strong one sudo passwdįrom the client, Transfer the key to the server ssh-copy-id -i ~/.ssh/foo "foo" the the name of your key and enter your server root password when asked. Restart the server sudo service ssh restart Make sure you allow root to log in with the following syntax PasswordAuthentication yes On the server (where you ssh TO)Įdit /etc/ssh/sshd_config sudo nano /etc/ssh/sshd_config To do this you must temporarily allow root to ssh into the server. Next you need to transfer the key to the server. When you are prompted for a password, just hit the enter key and you will generate a key with no password. The -f option specifies a file name, foo is an example, use whatever name you wish. I highly suggest you give it a name rather then using the default ssh-keygen -f foo On the client (where you ssh FROM)įirst make a ssh key with no password. If you do not have root access on the server, contact the server administrator for help. One way or another you need root access on the server to do this. Easiest method is to temporarily allow root to log in over ssh via password. To set up a passwordless SSH connection for the root user you need to have root access on the server.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |