首先生成ssh key
ssh-keygen -t rsa
其次将sshkey推送到服务器
cat ~/.ssh/id_rsa.pub | ssh user@iphost "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
将服务器上的内容推送到本地
使用 scp 命令
如果您想使用 scp 将整个目录从远程服务器复制到本地,您需要使用 -r(递归)选项来复制整个目录结构。命令如下:
scp -r username@remotehost.com:/path/to/remote/directory /path/to/local/destination
这里,-r 表示递归复制整个目录。