在Linux上完成密码字段scp命令

在Linux上完成密码字段scp命令

本文介绍了在Linux上完成密码字段scp命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个shell脚本来使用scp命令(SSH)在传输文件到计算机上。这显然​​是密码保护是有在两端以一种方式要么...禁用密码或自动完成对客户的密码?

Im writing a shell script to use the scp command (ssh) to transfer a file across to a computer. This obviously is password protected is there a way on either end to either...disable the password or to auto complete the password for the customer?

这纯粹出于方便易用,我不知道是否有可能(IM相当新的Linux)上,任何帮助或指针将AP preciated。

This out of pure convience and I have no idea if it is possible (im fairly new to linux), any help or pointers would be appreciated.

在此先感谢

推荐答案

您可以生成一对RSA / DSA密钥(公钥和私钥)的。在你的终端:

You can generate a pair of RSA/DSA keys (public and private). In your terminal:

$ ssh-keygen

这将生成一对文件:

It will generate a pair of files:


  • 私钥: 的.ssh / id_dsa的

  • 公开键: 的.ssh / id_dsa.pub

  • Private key: .ssh/id_dsa
  • Public key: .ssh/id_dsa.pub

然后,如果你有机会到远程主机,您可以将您的公共密钥的.ssh / authorized_keys中文件。在您的远程主机,复制公钥并使用以下命令:

Then, if you have access to remote host, you can add your public key to .ssh/authorized_keys file. In your remote host, copy the public key and use the following command:

cat id_dsa.pub >> .ssh/authorized_keys

这篇关于在Linux上完成密码字段scp命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 06:57