add a publickey to server for SCP [closed]

时间秒杀一切 提交于 2019-12-24 03:38:18

问题


My scenario is this, I am trying to SCP from server1 to server2 and and I need to create a public_key on server1 to allow server2 access to it. How do I do this?


回答1:


Use ssh-copy-id

ssh to the server1

ssh server1

generate an ssh key on server1

ssh-keygen -t rsa

copy this the public key to the autorized keys file on server2 of user "username"

ssh-copy-id -i ~/.ssh/id_rsa.pub username@server2

logout from server1

logout

Now you can login via ssh to server2 as username (or do scp stuff) from server1 without password.

For the other direction repeat the steps but switch the servers.



来源:https://stackoverflow.com/questions/13304317/add-a-publickey-to-server-for-scp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!