How to prevent a background process from being stopped after closing SSH client in Linux

前端 未结 20 1317
悲&欢浪女
悲&欢浪女 2020-11-22 06:16

I\'m working on a Linux machine through SSH (Putty). I need to leave a process running during the night, so I thought I could do that by starting the process in background (

20条回答
  •  孤街浪徒
    2020-11-22 06:51

    If you use screen to run a process as root, beware of the possibility of privilege elevation attacks. If your own account gets compromised somehow, there will be a direct way to take over the entire server.

    If this process needs to be run regularly and you have sufficient access on the server, a better option would be to use cron the run the job. You could also use init.d (the super daemon) to start your process in the background, and it can terminate as soon as it's done.

提交回复
热议问题