计算机知识分享网

【centos】CentOS最小化安装后开启SSH登录并设置开机自动启动

1、首先查看系统是否安装openssh:
[root@localhost ~]# rpm -qa | grep ssh
libssh2-1.4.3-10.el7.x86_64
openssh-server-6.6.1p1-22.el7.x86_64
openssh-clients-6.6.1p1-22.el7.x86_64
openssh-6.6.1p1-22.el7.x86_64
2、如果没有安装,则可通过yum在线安装:
yum install openssh
3.手动启动ssh服务,简单的设置就是在命令行中启动sshd服务。这样做比较快捷直接,但是只能对当前状态有效,一旦重启系统就丢失了该服务。
service sshd start
4.实现开机自动启动sshd服务。
[root@localhost ~]# chkconfig --list|grep sshd
sshd       0:off   1:off   2:off   3:off   4:off   5:off    6:off
[root@localhost ~]# chkconfig --level 5 sshd on
[root@localhost ~]# chkconfig --list|grep sshd
sshd       0:off   1:off   2:off   3:off   4:off   5:on    6:off

#Centos