Sudo Problem (File permissions)
Todd C. Miller
Todd.Miller at courtesan.com
Sat May 17 16:50:11 EDT 2003
My guess is that on your project PC the file already existed
and so when you ran the command with sudo nmap overwrote the
existing file rather than creating a new one as root.
If you need the output file to be owned by the user
running sudo and not root the simplest thing is probably
to use '-' for the output filename and use shell redirection
to make the output go to a file. Because the redirection is
done by the shell (and not sudo) the resulting file will
be owned by the user running sudo and not root.
sudo nmap -sP -n 192.168.1.0/24 -oG - > \
Alternately you could just have your java program create
/home/hippie/projektarbeit/java/activeHosts.txt if it
does not exist before running sudo.
More information about the sudo-users