Adding a public key to ~/.ssh/authorized_keys does not log me in automatically

前端 未结 30 2547
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-02 03:15

I added the public SSH key to the authorized_keys file. ssh localhost should log me in without asking for the password.

I did that and tried t

30条回答
  •  萌比男神i
    2020-12-02 03:53

    In the following, user is your username.

    mkdir -p /home/user/.ssh
    ssh-keygen -t rsa
    touch /home/user/.ssh/authorized_keys
    touch /home/user/.ssh/known_hosts
    chown -R user:user /home/user/.ssh
    chmod 700 /home/user/.ssh
    chmod 600 /home/user/.ssh/id*
    chmod 644 /home/user/.ssh/id*.pub
    chmod 644 /home/user/.ssh/authorized_keys
    chmod 644 /home/user/.ssh/known_hosts
    

提交回复
热议问题