ssh设置
常见问题:ssh:connection to host 127,0.0.1 port22: Connection refused
,解决办法如下:
首先安装openssh-server
yum install openssh-server
接着执行
/bin/systemctl start sshd.service
测试执行
ssh localhost
能否成功
其余命令:
开启服务
/bin/systemctl start sshd.service
查看服务状态
/bin/systemctl status sshd.service
停止服务
/bin/systemctl start sshd.service
设置开机自启–方式1
systemctl enable sshd.service
设置开机自启–方式2
chkconfig --level 3 sshd on
停止开机自启动
systemctl disable sshd.service
防火墙设置
fedora21使用firewalld构建动态防火墙,见FirewallD/zh-cn.常用的设置如下:
启动:
systemctl start firewalld
查看状态:
systemctl status firewalld (firewall-cmd --state)
停止:
systemctl disable firewalld
禁用:
systemctl stop firewalld
附录–Centos防火墙设置
centos7以上采用的是firewall
,
- 关闭防火墙:
sudo systemctl stop firewalld.service
- 关闭开机启动:
sudo systemctl disable firewalld.service
centos7以下采用的是iptables
,
- 停止防火墙:
service iptables stop
- 启动防火墙:
service iptables start
参考
【1】Fedora 17 设置开机自动启动服务systemctl
【2】CentOS7 防火墙关闭
【3】CentOS 配置防火墙操作实例(启、停、开、闭端口)