一。防火墙操作
1.在之前的版本(Redhat7以前)命令:
关闭防火墙等服务的命令是
service iptables stop
2.RHEL7中新命令
其实没有这个服务,在RHEL7开始,使用systemctl工具来管理服务程序,包括了service和chkconfig
[root@localhost test]# systemctl list-unit-files| grep fire
firewalld.service enabled
启动一个服务:systemctl start firewalld.service
关闭一个服务:systemctl stop firewalld.service
重启一个服务:systemctl restart firewalld.service
显示一个服务的状态:systemctl status firewalld.service
在开机时启用一个服务:systemctl enable firewalld.service
在开机时禁用一个服务:systemctl disable firewalld.service
查看服务是否开机启动:systemctl is-enabled firewalld.service;echo $?
查看已启动的服务列表:systemctl list-unit-files|grep enabled
二。ssh服务器
1.查看服务状态
systemctl status sshd
2.安装服务器
这是网络操作系统最重要的服务。
安装后检查
[root@localhost test]# rpm -qa| grep ssh
openssh-clients-6.6.1p1-22.el7.x86_64
openssh-server-6.6.1p1-22.el7.x86_64
libssh2-1.4.3-10.el7.x86_64
openssh-6.6.1p1-22.el7.x86_64
安装的话一定安装64位的,即带.x86_64后缀的
3.启动服务器
检查服务是否已经安装
[root@localhost test]# systemctl list-unit-files |grep sshd
sshd.service enabled(表示服务器已开启)
systemctl stop sshd.service redhat7版本命令
systemctl start sshd.service
systemctl restart sshd.service
3.配置服务器
systemctl disable sshd.service 禁止开机启动
systemctl enable sshd.service 开机启动
配置文件位置
/etc/ssh/sshd_config
Port 22 登录端口
PermitRootLogin yes 是否允许root登录