`
LIMIMGJIE
  • 浏览: 174774 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

在linux下使用远程拷贝命令scp时会出现去掉密码提示的方法

阅读更多

转贴注明出处:http://okone96.itpub.net/post/9033/391763

把你的本地主机用户的ssh公匙文件写入到远程主机用户的~/.ssh/authorized_keys文件中,具体方法
假设本地主机localhost,远程主机remote

一,在localhost主机里的用户

运行 ssh-keygen -t rsa
结果如下
Generating public/private rsa key pair.

Enter file in which to save the key (/home/.username/ssh/id_rsa):#回车

Enter passphrase (empty for no passphrase):#回车

Enter same passphrase again:#回车

Your identification has been saved in /home/.username /.ssh/id_rsa.

Your public key has been saved in /home/.username /.ssh/id_rsa.pub.

The key fingerprint is:

38:25:c1:4d:5d:d3:89:bb:46:67:bf:52:af:c3:17:0c username@localhost

Generating RSA keys:

Key generation complete.
会在用户目录~/.ssh/产生两个文件,id_rsa,id_rsa.pub

二,把id_rsa.pub文件拷贝到remote主机的用户目录下

cat id_rsa.pub >~/.ssh/authorized_keys
就可以了

这样localhost主机的用户就可以通过ssh而不用密码登陆remote主机

分享到:
评论

相关推荐

    ssh,scp 连接远程ssh非22端口的服务器方法

    而SCP(Secure Copy Protocol)则是基于SSH协议实现的安全拷贝工具,主要用于在本地与远程服务器之间或者两台远程服务器之间传输文件。 #### 二、SSH与SCP默认端口及修改 SSH和SCP默认监听的端口号为22。出于安全...

    工作中采用的linux命令

    **说明:** 使用 `scp` 命令将文件从远程机器传输到本地 SecureCRT 的 download 目录。 #### 17. 把本机文件传给 SecureCRT 中当前机器的当前目录 (scp) **格式:** `scp 文件名 用户名@localhost:/path/to/current` ...

    快速安装Linux双系统.pdf

    4. 使用SCP工具(如pscp.exe)进行远程拷贝,如果Linux ISO文件位于远程服务器上。 在Windows中配置GRUB: 1. 编辑Boot.ini文件,这是一个隐藏文件,需要显示所有文件才能看到。在命令行模式下,使用`attrib -s -h ...

    Linux常用的命令。。。。。

    scp file1 ip:file2 远程将本机file1拷贝到ip为此的机子的目录下 scp ip:file1 file2 远程将ip 的file1拷贝到本机file2 中 ln –s file1 file2 为file1创建file3的软连接 ln –s file1(绝对路径) file2(绝对路径) ...

    Ubuntu安装ssh服务和客户端linux操作系统 电脑资料 (2).docx

    # 从远程拷贝到本地 rsync -v -u -a --delete --rsh=ssh --stats username@192.168.0.1:/home/username/remotefile.txt . # 从本地拷贝到远程 rsync -v -u -a --delete --rsh=ssh --stats localfile.txt username@...

Global site tag (gtag.js) - Google Analytics