How to Set up Passwordless Ssh Access for Root User [Duplicate]
I Need to Configure a Machine So Software Installation Can Be Automated Remotely via Ssh. Following the Wiki, I Was Able to Setup Ssh Keys So My User Can...
I need to configure a machine so software installation can be automated remotely via SSH. Following the wiki, I was able to setup SSH keys so my user can access the machine without a password, but I still need to manually enter my password when I use sudo, which obviously an automated process shouldn't have to do.
Although my /etc/ssh/sshd_config has PermitRootLogin yes, I can't seem to be able to log in as root, presumably because it's not a "real" account with a separate password.
How do I configure SSH keys, so a process can remotely log in as root on Ubuntu?
4 Answers
Part 1 : SSH key without a password
To set up a passwordless SSH connection for the root user you need to have root access on the server. Easiest method is to temporarily allow root to log in over ssh via password. One way or another you need root access on the server to do this. If you do not have root access on the server, contact the server administrator for help.
On the client (where you ssh FROM)
First make a ssh key with no password. I highly suggest you give it a name rather then using the default
ssh-keygen -f foo
The -f option specifies a file name, foo is an example, use whatever name you wish.
When you are prompted for a password, just hit the enter key and you will generate a key with no password.
Next you need to transfer the key to the server. Easiest method is to use ssh-copy-id . To do this you must temporarily allow root to ssh into the server.