So my noob self turned on python -m SimpleHTTPServer
, not thinking about how to turn it off, is there any way to kill it?

- 55,668
- 25
- 164
- 183
-
If by "turned on" you mean that you started the process, you can kill it. Or reboot your computer. ;) Anyways, what do you mean by "security risk"? This depends on what you are using it for, in what context and what you're trying to protect. – Andrea Lazzarotto Jun 02 '17 at 00:58
3 Answers
It's not really possible to assess risk without taking into account other factors such as what user you ran it as, any firewall(s) you may be using, and your network configuration (such as routers and port forwarding).
In any case, you can kill it the same way you would kill any other process e.g.
pkill -f SimpleHTTPServer
(you should see something like
[1]+ Terminated python -m SimpleHTTPServer
by way of confirmation).

- 136,215
- 21
- 243
- 336
If you are sitting behind a NAT (you are using a simple router in home), if there are any firewall on your router or PC you are safe.
To stop this command after running it you can use Ctrl+C like all other commands.
If you ran it in the background so as others suggest it you should find the process and kill it:
$ pgrep -a python
14332 python -m SimpleHTTPServer
then:
$ kill -2 14332

- 55,668
- 25
- 164
- 183
You can check if the HTTP server process is running by opening up terminal then typing
ps aux | grep HTTP
and see if it is there.
If the process is running, type
kill -9 PID
with PID being the process identifier of the HTTP server.
Alternatively, you could reboot your OS and then the process should not be running.

- 592