SSH远程终端联接工具1、SSH简介
SSH是一种网路合同,用于计算机之间的加密登入。最早的时侯,互联网通讯都是明文通讯,一旦被查获linux ssh 远程登陆,内容就曝露无疑。1995年,法国学者TatuYlonen设计了SSH合同,将登陆信息全部加密,成为互联网安全的一个基本解决方案,迅速在全世界获得推广,目前早已成为Linux系统的标准配置。
2、SSH登入原理
3、SSH结构
SSH服务由服务端软件OpenSSH(openssl)和顾客端(常见的有SSH)linux ssh 远程登陆,SecureCRTlinux是什么,Putty,xshell组成,SSH服务默认使用22端口提供服务。
4、SSH服务认证类型1.4.1基于口令认证
基于口令的安全验证的方法就是你们如今仍然在用的,只要晓得服务器的SSH联接帐号和口令(其实也要晓得对应服务器的IP及开放的SSH端口,默认为22),就可以通过ssh顾客端登陆到这台远程主机。此时,联机过程中所有传输的数据都是加密的。
[root@master ~]# ssh 192.168.248.151
[email protected]'s password:
Last login: Thu Mar 30 20:38:49 2023 from 192.168.248.1
1.4.2基于秘钥认证
首先在顾客端生成一对秘钥
[root@master .ssh]# ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
SHA256:Ux0XwOaGjYc51S41UB7XrwO+Qo9ODNloYPHIW0KbW+E root@master
The key's randomart image is:
+---[DSA 1024]----+
| o . .+==.o|
| o B . .+++o.|
| O E .X.o...|
| . B =* B . .|
| o S .= o . |
| . +. . o |
| .oo . . |
| .o o |
| ... |
+----[SHA256]-----+
连续enterlinux 下载工具,在目录.ssh/下生成公钥和私钥
[root@master ~]# cd .ssh/
[root@master .ssh]# ll
总用量 12
-rw-------. 1 root root 672 3月 30 20:49 id_dsa #私钥
-rw-r--r--. 1 root root 601 3月 30 20:49 id_dsa.pub #公钥
-rw-r--r--. 1 root root 354 3月 30 20:39 known_hosts
将顾客端的私钥远程传到服务器端
[root@master .ssh]# ssh-copy-id -i id_dsa.pub [email protected]
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "id_dsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]'s password: #这里输入服务端登录密码
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '[email protected]'"
and check to make sure that only the key(s) you wanted were added.
之后测试一下
[root@master .ssh]# ssh 192.168.248.151 date
2023年 03月 30日 星期四 20:51:59 CST
之后才能登入到服务端
要想服务端可以登陆到客服端,在服务端销项该操作即可。
在服务端生成秘钥
[root@slave01 ~]# ssh-keygen -t dsa
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存出来直接上传(img-bEkqzs7T-88)(C:UsersQi桉诺AppDataRoamingTyporatypora-user-imagesimage-244854.png)]
将私钥传给顾客端,输入顾客端密码
[root@slave01 ~]# ssh-copy-id -i .ssh/id_dsa.pub [email protected]
进行验证联接
ssh 192.168.248.150 date
进行验证联接
ssh 192.168.248.150 date