古越剑箫

学习是一种习惯

  :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: :: 管理 ::

端口操作

手动更改配置文件开放端口

vim /etc/sysconfig/iptables

-A INPUT -p tcp -m state --state NEW -m tcp --dport 8161 -j ACCEPT

重启防火墙

 /etc/init.d/iptables restart

查看开放端口

/sbin/iptables -L -n

命令行式端口操作

1. 开放端口命令: /sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
2.保存:/etc/rc.d/init.d/iptables save
3.重启服务:/etc/init.d/iptables restart
4.查看端口是否开放:/sbin/iptables -L -n

 

1) 重启后生效 
开启: chkconfig iptables on 
关闭: chkconfig iptables off 

2) 即时生效,重启后失效 
开启: service iptables start 
关闭: service iptables stop 

需要说明的是对于Linux下的其它服务都可以用以上命令执行开启和关闭操作。 

在开启了防火墙时,做如下设置,开启相关端口, 
修改/etc/sysconfig/iptables 文件,添加以下内容: 
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT 
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

 

用户

查看用户 cat /etc/passwd

查看某一个用户 cat /etc/passwd|grep javaluna

新增用户 useradd xxx 

更新密码 passwd xxx

删除用户及相关配置 userdel -r xxx

 

posted on 2017-10-12 15:31  古越剑箫  阅读(306)  评论(0编辑  收藏  举报