1、实现上传文件功能
scp -r -P 33030 /usr/local/nginx/logs/access_120_2014-09-26.log
2、实现下载文件功能
scp -r -P 33030 /opt
3、SSH实现scp命令无需输入密码实现
1)本地机器先生成公钥
[[email protected]Client root]# ssh-keygen -b 1024 -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase): <-- 直接输入回车
Enter same passphrase again: <-- 直接输入回车
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
49:9c:8a:8f:bc:19:5e:8c:c0:10:d3:15:60:a3:32:1c root@Client
这样就会在 用户目录下的.ssh 目录下产生两个文件 id_rsa 和 id_rsa.pub,然后 把 id_rsa.pub的内容复制到 远程机器的 用户目录下 .ssh 目录下的文件authorized_keys中即可。不需要覆盖它,只要粘贴在原有内容下边就行。
时间: 2024-10-07 05:31:34