0%

Linx常用命令-Ubuntu

1.不保存命令执行记录

vi /root/.bash_history

用 history -c 清空历史命令.
在.bashrc的最后行追加
unset HISTFILE

2.开机启动项设置

​ sudo vi /etc/rc.local

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2,	开启防火墙,
启动firewall:

systemctl start firewalld.service
1
设置开机自启:
systemctl disable firewalld.service
systemctl enable firewalld.service
1
3, 重启防火墙:

systemctl restart firewalld.service
1
4, 检查防火墙状态是否打开:

firewall-cmd --state
1
开端口命令:firewall-cmd --zone=public --add-port=80/tcp --permanent
重启防火墙:systemctl restart firewalld.service

命令含义:

--zone #作用域

--add-port=80/tcp #添加端口,格式为:端口/通讯协议

--permanent #永久生效,没有此参数重启后失效
1
2
3
4
5
6
7
8
9
10
11
12
13
14
在CentOS 7系统中可以用systemd启动vpnserver,先新建启动脚本/etc/systemd/system/vpnserver.service:

[Unit]
Description=SoftEther VPN Server
After=network.target

[Service]
Type=forking
ExecStart=/usr/share/vpnserver/vpnserver start
ExecStop=/usr/share/vpnserver/vpnserver stop

[Install]
WantedBy=multi-user.target
然后就可以通过systemctl start vpnserver启动了,并通过systemctl enable vpnserver设置开机自启。
iBoy wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!