配置scp ssh

1、:生成密匙对

  [user@rh user]$ ssh-keygen -t rsa
   Generating public/private rsa key pair.
   Enter file in which to save the key (/home/user/.ssh/id_rsa):   --生成的过程中提示输入密钥对保存位置,直接回车,接受默认值
   Created directory '/home/user/.ssh'.
  
   Enter passphrase (empty for no passphrase):    --输入一个不同于你的password的密码,直接回车,让它空着,如果输入,后续每次远程连接都会提示输入密码
   Enter same passphrase again:
  
   Your identification has been saved in /home/user/.ssh/id_rsa.
   Your public key has been saved in /home/user/.ssh/id_rsa.pub.
   The key fingerprint is:
   e0:f0:3b:d3:0a:3d:da:42:01:6a:61:2f:6c:a0:c6:[email protected]
   [user@rh user]$

其中公共密钥保存在 ~/.ssh/id_rsa.pub   私有密钥保存在 ~/.ssh/id_rsa
修改 .ssh 目录的权限,"chmod 755 ~/.ssh"
   [user@rh user]$ chmod 755 ~/.ssh
 
将id_rsa.pub公共密钥复制到要访问的机器上,并保存为
   ~/.ssh/authorized_keys

大功告成。用ssh scp sftp 访问其他Linux机器时,就不用输入密码了

猜你喜欢

转载自host.iteye.com/blog/2319081