ssh使用默认及非默认22端口密钥登录
来源:互联网 发布:中科汇联怎么样知乎 编辑:程序博客网 时间:2024/06/05 15:36
一、远程服务器默认ssh端口为22
生成公钥,路径保持默认即可:
[root@xuegod2 .ssh]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
49:3a:5c:3c:50:d8:b3:a4:13:f4:6c:a9:b0:96:53:cb root@xuegod2.cn
The key's randomart image is:
+--[ RSA 2048]----+
| .o+. |
| o=+. |
| . .+Xo |
| BoB.o |
| = E.S |
| . . . |
| |
| |
| |
+-----------------+
将生成的公钥分发到远程服务器:
[root@xuegod2 .ssh]# ssh-copy-id -i root@192.168.10.31
root@192.168.10.31's password:
Now try logging into the machine, with "ssh 'root@192.168.10.31'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
登录远程服务器:
[root@xuegod2 .ssh]# ssh 192.168.10.31
Last login: Wed May 10 23:55:37 2017 from 192.168.10.32
Warning ! From now on, all of your operation has been record!
[root@xuegod1 ~]#
二、远程服务器默认ssh端口为非默认端口
这里将远程服务器ssh端口修改为2222
在客户端服务器上生成公钥:
[root@xuegod2 .ssh]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
08:83:aa:ea:55:22:b6:aa:e8:f9:c8:1e:3b:b4:bd:03 root@xuegod2.cn
The key's randomart image is:
+--[ RSA 2048]----+
| |
| . |
| . o |
| . o . |
|.o . .. S |
|oEo o |
|oo+. |
|=o*o |
|XOooo |
+-----------------+
分发生成的公钥到远程服务器:
[root@xuegod2 .ssh]# ssh-copy-id -i /root/.ssh/id_rsa.pub "-p2222 root@192.168.10.31"
root@192.168.10.31's password:
Now try logging into the machine, with "ssh '-p2222 root@192.168.10.31'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
登录远程服务器:
[root@xuegod2 .ssh]# ssh -p 2222 root@192.168.10.31
Last login: Wed May 10 23:39:10 2017 from 192.168.10.32
Warning ! From now on, all of your operation has been record!
[root@xuegod1 ~]#
- ssh使用默认及非默认22端口密钥登录
- Git配置SSH非默认端口(22)
- MySQL命令行非默认端口登录
- 修改ssh默认端口
- ssh默认端口修改
- ssh 改变默认端口
- 非默认端口
- Rsync使用非ssh默认端口从远程服务器同步文件到本地
- centos6.5 修改ssh默认端口号 禁用root登录
- ssh禁止root用户直接登录并修改默认端口
- 修改Linux SSH默认22端口
- CentOS 修改默认SSH的22端口
- centos修改ssh默认的22端口
- centos7 修改默认ssh端口 22
- ssh远程到远程服务器(非22端口号及非root登录)
- ssh远程到远程服务器(非22端口号及非root登录)
- FTP,ssh,HTTP,telnet,HTTPS用途及默认端口
- 如何修改ssh默认端口
- Python学习笔记
- Sublime Text 3配置Go语言开发环境
- Java加密/解密算法快速入门下篇[包括MD5、BASE64、DES、RSA等]
- Strange Way to Express Integers (模线性方程组(扩展欧几里得))
- u3d启用first person controller
- ssh使用默认及非默认22端口密钥登录
- springmvc整合freemarker
- 【C++】unsigned int和补码
- Centos7安装activemq5.14.5
- Android中使用opengl es2.0基础(2)- 三角形的绘制
- 设计模式--简单工厂模式
- js面向对象封装
- AOP切面知识学习笔记
- 使用网络技术之新闻客户端