cent os 7 怎么安装ssh
答案:2 悬赏:60 手机版
解决时间 2021-01-25 08:08
- 提问者网友:爱了却不能说
- 2021-01-24 19:26
cent os 7 怎么安装ssh
最佳答案
- 五星知识达人网友:洒脱疯子
- 2021-01-24 20:51
Centos默认自带VI,功能没VIM丰富,安装VIM取代VI。 用Yum查找源中的VIM包,不知安装哪个合适。 yum search vim vim-X11.i386 : The VIM version of the vi editor for the X Window System. vim-common.i386 : The common files needed by any
全部回答
- 1楼网友:第四晚心情
- 2021-01-24 21:40
方法如下:
1、编辑防火墙配置:vi /etc/sysconfig/iptables
防火墙增加新端口2222
-a input -m state --state new -m tcp -p tcp --dport 2222 -j accept
======================================================================
# firewall configuration written by system-config-firewall
# manual customization of this file is not recommended.
*filter
:input accept [0:0]
:forward accept [0:0]
:output accept [0:0]
-a input -m state --state established,related -j accept
-a input -p icmp -j accept
-a input -i lo -j accept
-a input -m state --state new -m tcp -p tcp --dport 22 -j accept
-a input -m state --state new -m tcp -p tcp --dport 2222 -j accept
-a input -j reject --reject-with icmp-host-prohibited
-a forward -j reject --reject-with icmp-host-prohibited
commit
重启防火墙,使配置生效:
/etc/init.d/iptables restart
service iptables restart
=======================================================================
2、备份ssh端口配置文件
cp /etc/ssh/ssh_config /etc/ssh/ssh_configbak
cp /etc/ssh/sshd_config /etc/ssh/sshd_configbak
修改ssh端口为:2222
vi /etc/ssh/sshd_config
在端口#port 22下面增加port 2222
vi /etc/ssh/ssh_config
在端口#port 22下面增加port 2222
重启:/etc/init.d/sshd restart
service sshd restart
用2222端口可以正常连接之后,再返回去重复上面的步骤。把22端口禁用了,以后ssh就只能用2222端口连接了!增强了系统的安全性。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯