netcat doesn't work as expected when detached from console with nohup (Ubuntu/Debian 64bit)

view story

http://unix.stackexchange.com – I'm trying to leave netcat running and close the ssh session (even stop the ssh daemon). But it then exits before all of the data is written. I'm testing in a console: nohup nc -l -p 4000 | dd of=/home/myname/test.txt 2>/run/user/myname/stderr 1>/run/user/myname/stdout & To test it, I close the console and in another console I dump a file: dd if=/var/log/Xorg.0.log | nc localhost 4000 Nothing gets written in /home/myname/test.txt. But if I remove the nohup command, test.txt contains all data dumped. How to get netcat working and detached from the console ? (HowTos)