Linux ->> Ubuntu 14.04 LTE下配置SSH免密码登录
首先用apt-get命令安装SSH
jerry@ubuntu:~$ sudo apt-get install ssh
[sudo] password for jerry:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libck-connector0 ncurses-term openssh-server openssh-sftp-server
ssh-import-id
Suggested packages:
rssh molly-guard monkeysphere
The following NEW packages will be installed:
libck-connector0 ncurses-term openssh-server openssh-sftp-server ssh
ssh-import-id
upgraded, newly installed, to remove and not upgraded.
Need to get kB of archives.
After this operation, , kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get: http://us.archive.ubuntu.com/ubuntu/ trusty/main libck-connector0 amd64 0.4.5-3.1ubuntu2 [10.5 kB]
Get: http://us.archive.ubuntu.com/ubuntu/ trusty/main ncurses-term all 5.9+20140118-1ubuntu1 [243 kB]
Get: http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main openssh-sftp-server amd64 1:6.6p1-2ubuntu2.3 [34.1 kB]
查找下用户目录下有没有.ssh文件夹。这个文件夹本身是个隐藏文件夹。安装SSH的时候应该默认会在安装用户的个人目录下创建改文件,如果没有就自己手动创建一个。至于它是用来干嘛的?SSH使用的是公钥加密。这个文件夹就是用来存放公钥和私钥两个文件的文件夹。
jerry@ubuntu:~$ ls -a -d .ssh ~
ls: cannot access .ssh: No such file or directory
/home/jerry
jerry@ubuntu:~$ mkdir ~/.ssh
jerry@ubuntu:~$ ls -a -d .ssh ~
/home/jerry .ssh
jerry@ubuntu:~$
接下来就是生成密钥了。这里用ssh_keygen命令生成密钥。-t表示加密类型,ssh支持rsa(目前流行的公钥加密算法)/dsa(digital signature algorithm数字签名算法)。-f表示公钥和私钥文件保存的路径。可以看到.ssh文件夹下生成了id_dsa(私钥)和id_dsa.pub(公钥)两个文件。
jerry@ubuntu:~$ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
Generating public/private dsa key pair.
Your identification has been saved in /home/jerry/.ssh/id_dsa.
Your public key has been saved in /home/jerry/.ssh/id_dsa.pub.
The key fingerprint is:
e8:::7d:ae:::::2f:::5d:b0:b3: jerry@ubuntu
The key's randomart image is:
+--[ DSA ]----+
| o.o. .. |
| . o. .. |
| E. . .o.|
| . =. + .+|
| . S.. + o o|
| . . . . = |
| . . . o|
| . o |
| . |
+-----------------+
jerry@ubuntu:~$ ls -a ~/.ssh/
. .. id_dsa id_dsa.pub
jerry@ubuntu:~$
添加公钥到认证的公钥证书列表中
jerry@ubuntu:~$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
jerry@ubuntu:~$
尝试用SSH连接本地服务器
jerry@ubuntu:~$ ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ECDSA key fingerprint is da:b7:c3:2a:ea:a2::4c:c3:c1::ca:0e:c2:ea:.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
Welcome to Ubuntu 14.04. LTS (GNU/Linux 3.19.--generic x86_64) * Documentation: https://help.ubuntu.com/ The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law. jerry@ubuntu:~$
有用的链接:
ssh: connect to host h2 port 22: No route to host
ssh登录 The authenticity of host 192.168.0.xxx can't be established. 的问题
SSH 登录失败:Host key verification failed 的处理方法
Linux ->> Ubuntu 14.04 LTE下配置SSH免密码登录的更多相关文章
- Linux ->> UBuntu 14.04 LTE下安装Hadoop 1.2.1(伪分布模式)
Hadoop的运行模式可分为单机模式.伪分布模式和分布模式. 首先无论哪种模式都需要安装JDK的,这一步之前的随笔Ubuntu 14.04 LTE下安装JDK 1.8中已经做了.这里就不多说了. 其次 ...
- Linux ->> UBuntu 14.04 LTE下主机名称和IP地址解析
UBuntu 14.04 LTE下主机名称和IP地址解析一些相关的配置文件: /etc/hosts: 主机文件.手工配置IP地址和主机名称间的映射.格式为每行一条映射条项: <machine_n ...
- Linux ->> UBuntu 14.04 LTE下安装Hadoop 1.2.1(集群分布式模式)
安装步骤: 1) JDK -- Hadoop是用Java写的,不安装Java虚拟机怎么运行Hadoop的程序: 2)创建专门用于运行和执行hadoop任务(比如map和reduce任务)的linux用 ...
- Linux ->> UBuntu 14.04 LTE下设置静态IP地址
UBuntu 14.04 LTE设置IP地址和一些服务器版本的Linux还不太一样.以Centos 7.0为例,网卡IP地址的配置文件应该是/etc/sysconfig/network-scripts ...
- Linux ->> Ubuntu 14.04 LTE下安装JDK 1.8
先到Oracle官网的下载中心下载JDK8的tar包到本地. 下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-dow ...
- Ubuntu16.04下配置ssh免密登录
Ubuntu16.04下配置ssh免密登录 环境准备:新建两台虚拟机,而且两台虚拟机上都装有Ubuntu16.04的系统,使两台虚拟机之间保持互通状态.分别为两台虚拟机命名为A,B.假设我们要使A虚拟 ...
- Linux配置SSH免密码登录
CentOS配置SSH免密码登录为例说明:SSH远程登录的安全外壳协议有两种身份认证机制: - 用户名+密码 -密钥登录 环境准备 host1:192.168.0.10host2:192.168.0. ...
- CentOS 6.5配置SSH免密码登录
centos 系统对权限的设置非常微妙,如果权限设置大了则ssh 拒绝,如果权限小了,则ssh 更是被拒绝(我曾经配置好久没有打通,就是因为权限过大的原因) 参考链接:http://www.linux ...
- 解决:centos配置ssh免密码登录后仍要输入密码
转自https://www.jb51.net/article/121180.htm 第一步:在本机中创建秘钥 1.执行命令:ssh-keygen -t rsa 2.之后一路回车就行啦:会在-(home ...
随机推荐
- 码云+jenkins+自动回复邮件
码云和jenkins的配置流程在Gitee Jenkins Plugin上介绍的很仔细. 附上码云官方Gitee Jenkins Plugin的介绍: https://gitee.com/help/a ...
- QT 相关
Qt是一个GUI框架,在GUI程序中,主线程也叫GUI线程,因为它是唯一被允许执行GUI相关操作的线程.对于一些耗时的操作,如果放在主线程中,就是出现界面无法响应的问题. 解决方法一:在处理耗时操作中 ...
- $bzoj1011-HNOI2008$ 遥远的行星 其他
题面描述 直线上\(N\)颗行星,\(X=i\)处有行星\(i\),行星\(j\)受到行星\(i\)的作用力,当且仅当\(i<=A_j\).此时J受到作用力的大小为\(F_{i\to j}=\f ...
- Java 数组算法列题解析
1.声明一个char类型的数组, 从键盘录入6个字符[1]遍历输出[2]排序[3]把char数组转化成一个逆序的数组 总结:分析问题时,先问自己,需要用到什么? 对于这题,第一步:先写一个main方 ...
- 文献综述十七:基于 sql环境下超市管理系统的设计与实现
一.基本信息 标题:基于 sql环境下超市管理系统的设计与实现 时间:2018 出版源:智能计算机与应用 文件分类:uml技术的研究 二.研究背景 从超市管理系统的实际应用出发,在系统分析过程中,从功 ...
- RMQ(求区间最值问题)
学习博客:https://blog.csdn.net/qq_31759205/article/details/75008659 RMQ(Range Minimum/Maximum Query),即区间 ...
- spring项目中aop的使用
AOP:是一种面向切面的编程范式,是一种编程思想,旨在通过分离横切关注点,提高模块化,可以跨越对象关注点.Aop的典型应用即spring的事务机制,日志记录.利用AOP可以对业务逻辑的各个部分进行隔离 ...
- spring mvc中的控制器方法中的参数从哪里传进来?
编写控制器方法的时候很奇怪,spring是怎么知道你控制器方法的参数类型,并且注入正确的对象呢? 比如下面这样 @RequestMapping(value="/register", ...
- Hibernate各种查询操作(二)
一.QBC的查询方式 使用QBC不在需要写hql语句,而是使用criteria对象的各种方法来实现. 1.查询所有 //使用QBC方式查询所有 @Test public void test11(){ ...
- VS 同词高亮显示
Visual Studio 2010 选中高亮插件 - Highlight all occurrences of selected word Highlight all occurrences of ...