SSH远程连接
文章目录
一、ssh是什么
前言介绍:SSH是专门为了远程登录会话和其他网络服务提供的安全性协议,使用SSH协议可以有效的防止远程连接会话的时候出现信息泄密,在数据传输的时候SSH会先对联机的数据包通过加密技术进行加密处理,加密后在进行数据的传输,确保了传输中的安全性,SSH服务主要提供两个服务功能:一个是远程联机的SSH服务,一个是借助SSH协议来传输数据的SFTP服务
二、ssh简介
1.ssh介绍
SSH 应用层协议
实现Linux主机加密、远程连接
适用于Linux服务器远程管理
telnet
远程连接,不加密
适用于局域网网络设备的远程连接
2.安装ssh服务
安装ssh服务
yum -y install openssh openssl
启动服务
systemctl start sshd
[root@localhost ~]# ps -elf | grep ssh
4 S root 951 1 0 80 0 - 28231 poll_s 08:51 ? 00:00:00 /usr/sbin/sshd -D
4 S root 1202 951 0 80 0 - 40384 poll_s 08:51 ? 00:00:00 sshd: root@pts/0
0 S root 1226 1204 0 80 0 - 28206 pipe_w 08:52 pts/0 00:00:00 grep --color=auto ssh
[root@localhost ~]# netstat -tunlp | grep "sshd"
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 951/sshd
tcp6 0 0 :::22 :::* LISTEN 951/sshd
[root@localhost ~]#
在查看端口中我们可以看到是 22/tcp 是ssh服务端口
对应服务端软件
[root@localhost ~]# rpm -qf /usr/sbin/sshd
openssh-server-7.4p1-21.el7.x86_64
这里我们可以看到是7.4 p1-21.el7 的版本型号 86线程 64位操作系统
三、客户端软件
windows 适用的是:
xshell
secureCRT
putty
linux : ssh命令
四、ssh的基本操作
1.ssh远程连接
ssh 用户名@服务器ip
2.执行远程命令
[root@localhost ~]# ifconfig ens33 | sed -n '2p' | awk '{print $2}' #显示本机ip命令
192.168.140.143
[root@localhost ~]# ssh root@192.168.140.144 ifconfig ens33 #使用ssh命令显示了192.168.140.144的ip信息
root@192.168.140.144's password: #ssh的密码验证 ip是144的密码
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.140.144 netmask 255.255.255.0 broadcast 192.168.140.255
inet6 fe80::20c:29ff:fe62:69d2 prefixlen 64 scopeid 0x20<link>
ether 00: