FC22 SSH open

来源:互联网 发布:对人工智能社会的畅想 编辑:程序博客网 时间:2024/06/05 19:54



一、Fedora 启动sshd服务:
1、先确认是否已安装ssh服务:

[root@localhost ~]# rpm -qa | grep openssh-serveropenssh-server-5.3p1-19.fc12.i686 (这行表示已安装)

若未安装ssh服务,可输入:

#yum install openssh-server

进行安装

2、修改配置文件

#vi /etc/ssh/sshd_config#Port 22  监听的端口号,默认是22,可以自定义。#Protocol 2  支持的协议,默认就好,不用修改#PermitRootLogin yes 是否允许root直接登录,最好设置为no#MMaxAuthTries 6 最大登录数,默认是6,建议设置为3,防止别人密码穷举。

修改完配置后,重启SSH服务:

[root@localhost ~]# /etc/rc.d/init.d/sshd restartStopping sshd: [ OK ]Starting sshd: [ OK ]:

3、查看sshd状态:

#service sshd status

4、将端口22(或者自定义的其他端口)加到防火墙的设置中,标记为Accept

#iptables -A 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即可

注意,如果安装的系统的镜像是Fedora LiveCD,则需要使用以下命令来开启SSH服务

#Fedora LiveCD的sshd服务默认是没有开启来的,ssh需要手动开启来,开启之后需要给root添加一个密码,不然ssh登录不上的[root@localhost ~]# systemctl enable sshd.serviceln -s '/usr/lib/systemd/system/sshd.service' '/etc/systemd/system/multi-user.target.wants/sshd.service'[root@localhost ~]# systemctl start sshd.service



ssh client 提示:Server responded"Algorithm negotiation failed"
                 Key exchange with the remote host failed. This can happen for
                 example computer does not support the selected algorthms.

问题已经解决了,修改ssh的配置文件 /etc/ssh/sshd_config

在配置文件中添加:

Ciphers aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,3des-cbc,arcfour128,arcfour256,arcfour,blowfish-cbc,cast128-cbc

MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-sha1-96,hmac-md5-96

KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org

0 0
原创粉丝点击