fedora21下ssh和防火墙设置


ssh设置

常见问题:ssh:connection to host 127,0.0.1 port22: Connection refused,解决办法如下:

  1. 首先安装openssh-server

    yum install openssh-server
    
  2. 接着执行/bin/systemctl start sshd.service

  3. 测试执行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 配置防火墙操作实例(启、停、开、闭端口)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值