1

I am remotely connected to a system using ssh and want to run nmap on a system from there. But every 5 minutes, my SSH connection breaks and so the process running on my shell stops.

How can I run nmap in the background so that any SSH session can interact with the process?

AdminBee
  • 21,637
  • 21
  • 47
  • 71
DeshBhakt
  • 145
  • 1
  • 5

2 Answers2

2

You could use nohup. But screen is what you are probably looking for.

Eduardo TrĂ¡pani
  • 12,032
  • 1
  • 18
  • 35
1

The task you are describing can unfortunately not accomplished by simply sending the process in the background on the remote machine. Even if you started it with

user@remote~$ ./script &

it would get killed if your SSH connection breaks.

Instead, you will have to use a terminal multiplexing software such as tmux or screen (availability may depend on your specific OS).

AdminBee
  • 21,637
  • 21
  • 47
  • 71