Skip to content

SSH without password in Ubuntu 16.04

bluecryolite edited this page Jan 6, 2018 · 4 revisions

Prepare
login Ubuntu by account of root.

Using RSA:

  1. Change "PermitRootLogin prohibit-password" to "PermitRootLogin yes" in /etc/ssh/sshd_config.
    Then restart the service of sshd(service sshd restart)

  2. Create RSA:
    ssh-keygen -trsa -P'' -f/root/.ssh/id_rsa

  3. Append Pub Key to authorized file:
    ssh-copy-id -iid_rsa root@localhost
    Need input password for root once in processing.

  4. Verify SSH without password:
    ssh localhost
    Success by showing SSH into without password.

Using DSA:

  1. Change "PermitRootLogin prohibit-password" to "PermitRootLogin yes" in /etc/ssh/sshd_config, and add the line of "PubkeyAcceptedKeyTypes=+ssh-dss" into it.
    Then restart the service of sshd(service sshd restart)

  2. Create DSA:
    ssh-keygen -tdsa -P'' -f/root/.ssh/id_dsa

  3. Create the file named config at /root/.ssh.
    Then add the line of "PubkeyAcceptedKeyTypes=+ssh-dss" into it.

  4. Append Pub Key to authorized file:
    ssh-copy-id -iid_dsa root@localhost
    Need input password for root once in processing.

  5. Verify SSH without password:
    ssh localhost
    Success by showing SSH into without password.

Clone this wiki locally