博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux scp ssh命令不用输入密码
阅读量:7086 次
发布时间:2019-06-28

本文共 984 字,大约阅读时间需要 3 分钟。

把你的本地主机用户的ssh公匙文件复制到远程主机用户的~/.ssh/authorized_keys文件中
假设本地主机linux100,远程主机linux200
一,在linux100主机里的用户
运行
#ssh-keygen -t rsa
结果如下
QUOTE:
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
二,把linux100主机上的id_rsa.pub文件拷贝到linux200主机的root用户主目录下的.ssh目录下,并且改名为authorized_keys
即:
/root/.ssh/authorized_keys
这样在linux100主机上使用scp命令复制文件到linux200上将不提示输入密码了,直接复制了。
反之亦然!
 
 
从实验的过程中发现:
双方只能在root权限下使用
 
如果配置完成之后,发现还是不好使,需要检查/etc/ssh目录下的sshd_config文件下的
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys
 
3行是否打开,如果为注释掉的,则需要打开。
 

 

转载地址:http://ssgml.baihongyu.com/

你可能感兴趣的文章
Python 黑帽编程 4.2 Sniffer之数据本地存储和加载
查看>>
postgresql 死锁处理
查看>>
使用JNI的步骤
查看>>
RPi 2B SD read-only filesytem
查看>>
编程珠玑--位图法排序
查看>>
JSP 实用程序之简易文件上传组件
查看>>
【Android】使用SearchView时软键盘不支持actionSearch的问题
查看>>
java的Xmx是设置什么的?
查看>>
当数据库中字段设计为smalint或者tinyint后,程序中要求字段为枚举型,应该怎么设置...
查看>>
iOS开发之邮件发送代码
查看>>
八皇后问题(递归版)
查看>>
第 33 章 Message Queuing & RPC
查看>>
Discuz Table ‘common_member_archive’ doesn’t exist
查看>>
[家里蹲大学数学杂志]第396期中国科学技术大学数学科学学院2015年直博生摸底考试试题...
查看>>
Awesome Reinforcement Learning
查看>>
Redis基础知识 之——发布/订阅
查看>>
微信小程序开发教程第六章:「我」的页面开发
查看>>
印度浦那三周感受
查看>>
Solr5.3.1通过copyField设置多个field(字段)同时检索
查看>>
flask+sqlite3+echarts2+ajax数据可视化--静态图
查看>>