Linux SSH服务开通[Fedora 12]

近期安装了一台Fedora 12虚拟机, 可以在自己电脑上ssh连接到这台Linux, 用起来很方便. 这里记一下是怎么配置的.

1) 安装openssh-server

[root@localhost ~]# yum install openssh-server
2) 查看是否已成功安装openssh-server

[root@localhost ~]# rpm -qa | grep openssh-server


openssh-server-5.3p1-19.fc12.i686
[root@localhost ~]#


3) 修改ssh服务的配置文件

配置ssh服务的运行参数, 是通过修改配置文件/etc/ssh/ssh_config实现的. /etc/ssh/ssh_config文件的配置选项非常多, 但大部分都已经用"#"注释掉了.

#Port 22 

#Protocol 2,1 

#PermitRootLogin yes 

配置完保存配置文件, 不过如果没什么特殊的要求这都不用配置.

 

1.启动SSH服务

# systemctl start sshd.service

 

2.随系统一起启动服务

# systemctl enable sshd.service

 

3.开启防火墙22端口

# iptables -I INPUT -p tcp --dport 22 -j ACCEPT

 

 

也可以将上述参数加入防火墙配置中:

   #vi /etc/sysconfig/iptables

  加入:-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

   保存后重启iptables即可

 

如果仍然有问题,就可能是SELinux导致的

关闭selinux:

修改/etc/selinux/config文件中的SELINUX="" 为 disabled,然后重启

===================================

[root@CC init.d]# systemctl start sshd.service

[root@CC init.d]# systemctl enable sshd.service
ln -s '/usr/lib/systemd/system/sshd.service' '/etc/systemd/system/multi-user.target.wants/sshd.service'


[root@CC init.d]# iptables -I INPUT -p tcp --dport 22 -j ACCEPT
 
===================================

 

重启后生效:

iptables-save >/etc/sysconfig/iptables

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值