如何杀死不存在的程序进程

问题描述 投票:0回答:1

几天前,我在我的ubuntu 16.04中安装了shellinabox,因为我不再使用它,所以我通过sudo apt-get remove shellinabox卸载它。卸载成功后,我检查了进程,发现shellinabox进程仍然存在,如果我杀了这个进程,几秒钟后,它再次显示。

ldh@ldh55:~$ 
ldh@ldh55:~$ ps -ef|grep shellinabox
ldh        5178  10185  0 14:10 pts/21   00:00:00 grep --color=auto shellinabox
nobody   113899 113881  0 13:56 ?        00:00:00 shellinaboxd -t -s /:LOGIN -s /python:shell:shell:HOME:/usr/bin/python -s /ipython:shell:shell:HOME:/usr/bin/ipython -s /python3:shell:shell:HOME:/usr/bin/python3 -s /ipython3:shell:shell:HOME:/usr/bin/ipython3 -s /cling:shell:shell:HOME:/usr/local/bin/cling --static-file=styles.css:/usr/local/share/shellinabox/shellinabox.css --user-css=Tomorrow Light:+/usr/local/share/shellinabox/theme-tomorrow-light.css,Tomorrow Dark:-/usr/local/share/shellinabox/theme-tomorrow-dark.css
nobody   113990 113899  0 13:56 ?        00:00:00 shellinaboxd -t -s /:LOGIN -s /python:shell:shell:HOME:/usr/bin/python -s /ipython:shell:shell:HOME:/usr/bin/ipython -s /python3:shell:shell:HOME:/usr/bin/python3 -s /ipython3:shell:shell:HOME:/usr/bin/ipython3 -s /cling:shell:shell:HOME:/usr/local/bin/cling --static-file=styles.css:/usr/local/share/shellinabox/shellinabox.css --user-css=Tomorrow Light:+/usr/local/share/shellinabox/theme-tomorrow-light.css,Tomorrow Dark:-/usr/local/share/shellinabox/theme-tomorrow-dark.css
ldh@ldh55:~$ 
ldh@ldh55:~$ kill -9 113899
-bash: kill: (113899) - Operation not permitted
ldh@ldh55:~$ sudo !!
sudo kill -9 113899
ldh@ldh55:~$ ps -ef|grep shellinabox
ldh        5637  10185  0 14:10 pts/21   00:00:00 grep --color=auto shellinabox
ldh@ldh55:~$ 
ldh@ldh55:~$ ps -ef|grep shellinabox
ldh        5754  10185  0 14:10 pts/21   00:00:00 grep --color=auto shellinabox
ldh@ldh55:~$ ps -ef|grep shellinabox
nobody     5693   5675  1 14:10 ?        00:00:00 shellinaboxd -t -s /:LOGIN -s /python:shell:shell:HOME:/usr/bin/python -s /ipython:shell:shell:HOME:/usr/bin/ipython -s /python3:shell:shell:HOME:/usr/bin/python3 -s /ipython3:shell:shell:HOME:/usr/bin/ipython3 -s /cling:shell:shell:HOME:/usr/local/bin/cling --static-file=styles.css:/usr/local/share/shellinabox/shellinabox.css --user-css=Tomorrow Light:+/usr/local/share/shellinabox/theme-tomorrow-light.css,Tomorrow Dark:-/usr/local/share/shellinabox/theme-tomorrow-dark.css
nobody     5758   5693  0 14:10 ?        00:00:00 shellinaboxd -t -s /:LOGIN -s /python:shell:shell:HOME:/usr/bin/python -s /ipython:shell:shell:HOME:/usr/bin/ipython -s /python3:shell:shell:HOME:/usr/bin/python3 -s /ipython3:shell:shell:HOME:/usr/bin/ipython3 -s /cling:shell:shell:HOME:/usr/local/bin/cling --static-file=styles.css:/usr/local/share/shellinabox/shellinabox.css --user-css=Tomorrow Light:+/usr/local/share/shellinabox/theme-tomorrow-light.css,Tomorrow Dark:-/usr/local/share/shellinabox/theme-tomorrow-dark.css
ldh        5792  10185  0 14:10 pts/21   00:00:00 grep --color=auto shellinabox
ldh@ldh55:~$ 
ldh@ldh55:~$ sudo ls -l /proc/5693/
total 0
dr-xr-xr-x 2 nobody nogroup 0 Sep  5 14:11 attr
-rw-r--r-- 1 root   root    0 Sep  5 14:11 autogroup
-r-------- 1 root   root    0 Sep  5 14:11 auxv
-r--r--r-- 1 root   root    0 Sep  5 14:10 cgroup
--w------- 1 root   root    0 Sep  5 14:11 clear_refs
-r--r--r-- 1 root   root    0 Sep  5 14:10 cmdline
-rw-r--r-- 1 root   root    0 Sep  5 14:11 comm
-rw-r--r-- 1 root   root    0 Sep  5 14:11 coredump_filter
-r--r--r-- 1 root   root    0 Sep  5 14:11 cpuset
lrwxrwxrwx 1 root   root    0 Sep  5 14:11 cwd -> /home/shell
-r-------- 1 root   root    0 Sep  5 14:10 environ
lrwxrwxrwx 1 root   root    0 Sep  5 14:10 exe -> /usr/bin/shellinaboxd
dr-x------ 2 root   root    0 Sep  5 14:10 fd
dr-x------ 2 root   root    0 Sep  5 14:11 fdinfo
-rw-r--r-- 1 root   root    0 Sep  5 14:11 gid_map
-r-------- 1 root   root    0 Sep  5 14:11 io
-r--r--r-- 1 root   root    0 Sep  5 14:11 limits
-rw-r--r-- 1 root   root    0 Sep  5 14:11 loginuid
dr-x------ 2 root   root    0 Sep  5 14:11 map_files
-r--r--r-- 1 root   root    0 Sep  5 14:11 maps
-rw------- 1 root   root    0 Sep  5 14:11 mem
-r--r--r-- 1 root   root    0 Sep  5 14:10 mountinfo
-r--r--r-- 1 root   root    0 Sep  5 14:11 mounts
-r-------- 1 root   root    0 Sep  5 14:11 mountstats
dr-xr-xr-x 5 nobody nogroup 0 Sep  5 14:11 net
dr-x--x--x 2 root   root    0 Sep  5 14:10 ns
-r--r--r-- 1 root   root    0 Sep  5 14:11 numa_maps
-rw-r--r-- 1 root   root    0 Sep  5 14:11 oom_adj
-r--r--r-- 1 root   root    0 Sep  5 14:11 oom_score
-rw-r--r-- 1 root   root    0 Sep  5 14:10 oom_score_adj
-r-------- 1 root   root    0 Sep  5 14:11 pagemap
-r-------- 1 root   root    0 Sep  5 14:11 personality
-rw-r--r-- 1 root   root    0 Sep  5 14:11 projid_map
lrwxrwxrwx 1 root   root    0 Sep  5 14:11 root -> /
-rw-r--r-- 1 root   root    0 Sep  5 14:11 sched
-r--r--r-- 1 root   root    0 Sep  5 14:11 schedstat
-r--r--r-- 1 root   root    0 Sep  5 14:11 sessionid
-rw-r--r-- 1 root   root    0 Sep  5 14:11 setgroups
-r--r--r-- 1 root   root    0 Sep  5 14:11 smaps
-r-------- 1 root   root    0 Sep  5 14:11 stack
-r--r--r-- 1 root   root    0 Sep  5 14:10 stat
-r--r--r-- 1 root   root    0 Sep  5 14:11 statm
-r--r--r-- 1 root   root    0 Sep  5 14:10 status
-r-------- 1 root   root    0 Sep  5 14:11 syscall
dr-xr-xr-x 3 nobody nogroup 0 Sep  5 14:11 task
-r--r--r-- 1 root   root    0 Sep  5 14:11 timers
-rw-r--r-- 1 root   root    0 Sep  5 14:10 uid_map
-r--r--r-- 1 root   root    0 Sep  5 14:11 wchan
ldh@ldh55:~$ 
ldh@ldh55:~$ ll /usr/bin/shellinaboxd
ls: cannot access '/usr/bin/shellinaboxd': No such file or directory
ldh@ldh55:~$
linux kill ps
1个回答
0
投票

感谢@Amadan和@pitseeker,我检查了父进程的pstree,发现奇怪的进程可能是dockinabox进程,它在docker容器中,因为我也运行了shellinabox docker容器。

ldh@ldh55:~$ pstree -p 5675
docker-containe(5675)─┬─shellinaboxd(5693)───shellinaboxd(5758)
                      ├─{docker-containe}(5676)
                      ├─{docker-containe}(5677)
                      ├─{docker-containe}(5678)
                      ├─{docker-containe}(5679)
                      ├─{docker-containe}(5680)
                      ├─{docker-containe}(5681)
                      ├─{docker-containe}(5682)
                      ├─{docker-containe}(5683)
                      └─{docker-containe}(5757)
ldh@ldh55:~$ ps -ef|grep 5675
root       5675  15288  0 14:10 ?        00:00:00 docker-containerd-shim a865ae1d7398f23f8c3e484bce9817522b57a5f68d37a6756e812c93e72e4d1c /var/run/docker/libcontainerd/a865ae1d7398f23f8c3e484bce9817522b57a5f68d37a6756e812c93e72e4d1c docker-runc
nobody     5693   5675  0 14:10 ?        00:00:00 shellinaboxd -t -s /:LOGIN -s /python:shell:shell:HOME:/usr/bin/python -s /ipython:shell:shell:HOME:/usr/bin/ipython -s /python3:shell:shell:HOME:/usr/bin/python3 -s /ipython3:shell:shell:HOME:/usr/bin/ipython3 -s /cling:shell:shell:HOME:/usr/local/bin/cling --static-file=styles.css:/usr/local/share/shellinabox/shellinabox.css --user-css=Tomorrow Light:+/usr/local/share/shellinabox/theme-tomorrow-light.css,Tomorrow Dark:-/usr/local/share/shellinabox/theme-tomorrow-dark.css
ldh      104903  90695  0 15:11 pts/22   00:00:00 grep --color=auto 5675
ldh@ldh55:~$
ldh@ldh55:~$ docker ps|grep shellinabox
a865ae1d7398        9d6d77a31ef3                                             "shellinaboxd -t -..."   5 months ago        Up About an hour    0.0.0.0:5200->4200/tcp                          shellinaboxshell_shellinabox-shell_1
ldh@ldh55:~$ 
ldh@ldh55:~$ docker stop a865ae1d7398
a865ae1d7398
ldh@ldh55:~$ 
ldh@ldh55:~$ ps -ef|grep shellinabox
ldh      115468  90695  0 15:17 pts/22   00:00:00 grep --color=auto shellinabox
ldh@ldh55:~$ 
ldh@ldh55:~$
© www.soinside.com 2019 - 2024. All rights reserved.