I'm trying to start tcpdump on several remote machines to perform some network analysis with a script, but I'm failing to run it correctly. The command I would like to use is:
ssh user@host "nohup sudo /usr/sbin/tcpdump udp -l -s 68 -n -v -i eth0 1>tcpdump.txt 2>tcpdump.err &"
With the intention to start tcpdump remotely, pipe the results to file and return immediately. Not having a keyboard installed on the remote machine, all I get is
sudo: no tty present and no askpass program specified
written in tcpdump.err. I also tried:
- writing the command in a bash script and running the script remotely
- enclosing the sudo part in the 'script' command (script -c 'nohup sudo...')
but with no success. Is there some other alternatives I can try?