按照前文提及的内容下载的镜像,SSH服务已经安装并配置。
此文作为备查文档进行相关内容进行描述。
查看openssh-server 是否已经安装
[root@localhost ~]# yum list installed | grep openssh-server
openssh-server.aarch64 7.4p1-21.el7 installed
查看相关的配置文件 /etc/ssh/sshd_config,如果需要可以进行编辑。
[root@localhost ~]# cat /etc/ssh/sshd_config
# $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/local/bin:/usr/bin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value.
# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
#
#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
[root@localhost ~]# vi /etc/ssh/sshd_config
# ------------------------------------------------
Port 22
ListenAddress 0.0.0.0
ListenAddress ::
PermitRootLogin yes
PasswordAuthentication yes
查看服务进程是否启动
[root@localhost ~]# ps -e | grep sshd
581 ? 00:00:00 sshd
617 ? 00:00:00 sshd
查看端口22是否监听
[root@localhost ~]# netstat -an | grep 22
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 36 192.168.0.106:22 192.168.0.119:51292 ESTABLISHED
tcp6 0 0 :::22 :::* LISTEN
服务启动、重启和停止
[root@localhost ~]# service sshd start
Redirecting to /bin/systemctl start sshd.service
[root@localhost ~]# service sshd restart
Redirecting to /bin/systemctl restart sshd.service
[root@localhost ~]# service sshd stop
Redirecting to /bin/systemctl stop sshd.service
附文:
镜像下载