Can I keep my session? And reconnect on that?

Hello, I use kali Linux on Linode. I generally run scans on my VPS so it takes time. Sometimes when I disconnect from the internet, my scan will stop. And I have to run the scan again from 0. It's waste my lot of time.

So my question is there any way that I run my scan on VPS and though I disconnect from the internet it's run in the background and when I reconnect with my SSH login credentials I can show its present stage.

1 Reply

Start your scan program in the background & have it write it’s output to a log file:

sudo /the/path/to/the/scannerprogram >/tmp/out.log 2>/tmp/err.log &

The progam’s stdout will be written to /tmp/out.log & the program’s stderr will be written to /tmp/err.log. The & at the end of the command tells the shell to run it in the background.

I assumed sudo would be required because of your description of what the program does.

See:

https://linuxize.com/post/how-to-run-linux-commands-in-background/

In order to for sudo to not prompt for a password when you run sudo /the/path/to/the/scannerprogram, create a file named the same as your login name in /etc/sudoers.d:

-rw-r--r--  1 root  root  741 Nov  6  2021 stevewi

with the line:

stevewi ALL=(ALL) NOPASSWD: /the/path/to/the/scannerprogram

in it. stevewi is my login account.

After that, sudo will no longer prompt you for a password when you run the command sudo /the/path/to/the/scannerprogram. Then, can put the whole thing in a cron job and let Linux run it in the background for you using whatever schedule you like.

— sw

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct