日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

kali里PHP文件502错误,解决Linux Kali iptables开放22端口失败等一系列问题

發布時間:2025/3/8 linux 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 kali里PHP文件502错误,解决Linux Kali iptables开放22端口失败等一系列问题 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

這篇文章是針對2020年下載安裝的kali系統碰到的關于 iptables開放22端口失敗等一系列問題的解決辦法,如果是其它系統,可以借鑒一下思路。

各種報錯:

# sudo systemctl start iptables

Failed to start iptables.service: Unit iptables.service not found.

# sudo systemctl enable iptables

Failed to enable unit: Unit file iptables.service does not exist.

# sudo service iptables start

Failed to start iptables.service: Unit iptables.service not found.

# sudo service iptables enable

iptables: unrecognized service

0

1

2

3

4

5

6

7

8

9

10

# sudo systemctl start iptables

Failedtostartiptables.service:Unitiptables.servicenotfound.

# sudo systemctl enable iptables

Failedtoenableunit:Unitfileiptables.servicedoesnotexist.

# sudo service iptables start

Failedtostartiptables.service:Unitiptables.servicenotfound.

# sudo service iptables enable

iptables:unrecognizedservice

下面的錯誤是怎么出來的我忘了

See systemctl status iptables.service" and "journalctl -xe" for details.

Job for iptables.service failed because the control process exited with error code.

0

1

Seesystemctlstatusiptables.service" and "journalctl-xe"fordetails.

Jobforiptables.servicefailedbecausethecontrolprocessexitedwitherrorcode.

主要思想就是想盡量少的安裝其它不必要的命令,所以折騰了好一陣子。

開機啟動默認會執行/etc/init.d/ 下的所有可執行文件,

所以,粗暴點,就在這個文件夾(/etc/init.d/)下加個我自己的可執行文件吧,寫好shell語言,也方便我以后再折騰。

步驟:

1、創建文件

$ sudo vim /etc/init.d/mrdede.init

文件內容:

#!/bin/sh

### BEGIN INIT INFO

# Default-Start:???? 2 3 4 5

# Default-Stop:????? 0 1 6

### END INIT INFO

# mrdede Custom File

# iptables 開放 22 端口

iptables -A INPUT -p tcp --dport 22 -j ACCEPT

# 開啟 SSH 服務

service sshd start

if [ $? -ne 0 ]

then

service ssh start

fi

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

#!/bin/sh

### BEGIN INIT INFO

# Default-Start:???? 2 3 4 5

# Default-Stop:????? 0 1 6

### END INIT INFO

# mrdede Custom File

# iptables 開放 22 端口

iptables-AINPUT-ptcp--dport22-jACCEPT

# 開啟 SSH 服務

servicesshdstart

if[$?-ne0]

then

servicesshstart

fi

2、完成后保存 :wq + 回車

3、文件設置來可執行文件

$ sudo chmod +x /etc/init.d/mrdede.init

0

$sudochmod+x/etc/init.d/mrdede.init

4、重啟主機

$ sudo reboot

5、驗證是否成功。

1)先查看iptable新添加的端口是否存在

$ sudo iptables –list

2)再看service中是的ssh是否啟動

$ sudo service –status-all

顯示出來的是所有服務,前面帶有 [ + ] 表示已啟動,[ - ] 表示已關閉

找到ssh ,正常的話應該是已啟動,之后還可以看到之前加入到服務器的mrdede.init 文件。

6、完成。

多種原因可以造成同一種問題的表現,所以如果這篇文章沒有解決你的問題,可以參考其它文章繼續你的折騰。

總結

以上是生活随笔為你收集整理的kali里PHP文件502错误,解决Linux Kali iptables开放22端口失败等一系列问题的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。