Skip to content

Commit 447c760

Browse files
committed
更新Linux说明文档
1 parent 829f775 commit 447c760

1 file changed

Lines changed: 79 additions & 0 deletions

File tree

Linux.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,3 +616,82 @@ chkconfig --list | systemctl list-unit-files --type=service (推荐) ls /etc
616616
chkconfig frobozz --list | ls /etc/systemd/system/*.wants/frobozz.service | 用来列出该服务在哪些运行级别下启用和禁用。
617617
chkconfig frobozz --add | systemctl daemon-reload | 当您创建新服务文件或者变更设置时使用。
618618

619+
620+
## 网络调试
621+
622+
623+
```bash
624+
telnet IP PORT
625+
```
626+
627+
调试TCP
628+
```bash
629+
nc -l ip port # 开启监听
630+
nc ip port # 连接服务
631+
```
632+
633+
调试UDP
634+
```bash
635+
nc -u -l ip port # 开启监听
636+
nc -u ip port # 连接服务
637+
```
638+
639+
640+
## 网络服务
641+
642+
快速开启网络web服务
643+
644+
```bash
645+
php -S 0:8888
646+
```
647+
http://0.0.0.0:8888
648+
649+
```bash
650+
python -m SimpleHTTPServer 8866
651+
```
652+
http://0.0.0.0:8866
653+
654+
655+
区别,PHP版本需要index.php, 而python版本直接返回目录
656+
657+
658+
## CentOs
659+
660+
SELinux 全称 Security Enhanced Linux (安全强化 Linux)
661+
662+
是 MAC (Mandatory Access Control,强制访问控制系统)的一个实现,
663+
目的在于明确的指明某个进程可以访问哪些资源(文件、网络端口等)。
664+
665+
666+
- Disabled 代表 SELinux 被禁用
667+
- Permissive 代表仅记录安全警告但不阻止可疑行为
668+
- Enforcing 代表记录警告且阻止可疑行为。
669+
670+
目前常见发行版中,RHEL 和 Fedora 默认设置为 Enforcing,其余的如 openSUSE 等为 Permissive。
671+
672+
获取当前 SELinux 运行状态(Enforcing、Permissive 和 Disabled)
673+
```
674+
# getenforce
675+
```
676+
677+
改变 SELinux 运行状态
678+
```
679+
# setenforce [ Enforcing | Permissive | 1 | 0 ]
680+
```
681+
682+
查看 SELinux 文件
683+
```
684+
# vim /etc/sysconfig/selinux
685+
```
686+
687+
688+
## DNS 反向解析
689+
690+
关闭反向解析
691+
```bash
692+
# vim /etc/ssh/sshd_config
693+
```
694+
设置 UseDNS no
695+
```bash
696+
# service sshd restart
697+
```

0 commit comments

Comments
 (0)