我正在尝试在我的 ubuntu 22.04 上设置代码服务器。但是我意识到我的防火墙未启用,并尝试使用另一个线程中的说明启用它:https://superuser.com/questions/590600/ufw-is-active-but-not-enabled-why。
当检查防火墙的状态时,我被告知它处于非活动状态。当执行 sudo ufw enable 时,我收到此错误消息。:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/ufw/util.py", line 427, in under_ssh
ppid = get_ppid(pid)
File "/usr/lib/python3/dist-packages/ufw/util.py", line 419, in get_ppid
ppid = open(name).readlines()[0].split(')')[1].split()[1]
IndexError: list index out of range
在处理上述异常的过程中,又发生了另一个异常:
Traceback (most recent call last):
File "/usr/sbin/ufw", line 138, in <module>
not ui.continue_under_ssh():
File "/usr/lib/python3/dist-packages/ufw/frontend.py", line 901, in continue_under_ssh
if self.backend.do_checks and ufw.util.under_ssh(): # pragma: no cover
File "/usr/lib/python3/dist-packages/ufw/util.py", line 457, in under_ssh
return under_ssh(ppid)
File "/usr/lib/python3/dist-packages/ufw/util.py", line 457, in under_ssh
return under_ssh(ppid)
File "/usr/lib/python3/dist-packages/ufw/util.py", line 457, in under_ssh
return under_ssh(ppid)
[Previous line repeated 1 more time]
File "/usr/lib/python3/dist-packages/ufw/util.py", line 434, in under_ssh
raise ValueError(err_msg)
ValueError: Couldn't find parent pid for '2182'