Setup SFTP to use public-key authentication

前端 未结 3 1007
隐瞒了意图╮
隐瞒了意图╮ 2021-02-20 10:46

How do you setup server to server SFTP to use public-key authentication instead of user account and password?

3条回答
  •  北荒
    北荒 (楼主)
    2021-02-20 11:08

    In the client you need to generate its public key and add it to server's authorized key list.

    The following are the commands you can use.

    On client machine

    ssh-keygen -t dsa -f id_dsa
    mv id_dsa* ~/.ssh/
    scp ~/.ssh/id_dsa.pub USER_NAME@SERVER:~/.ssh/HOST_NAME.key
    

    On the server

    cat ~/.ssh/HOST_NAME.key >> ~/.ssh/authorized_keys2
    

提交回复
热议问题