dapper sudo

Alexander Skwar listen at alexander.skwar.name
Tue Jul 4 13:43:30 UTC 2006


boricua wrote:
> how come dapper does not allow me to do this
> 
>  sudo cat /dev/null >  /var/log/apache2/error.log

This doesn't have anything to do with dapper. What makes
you think so? Does the above work at a different distribution?

Anyway, it doesn't work, as the redirection (>) isn't done
by sudo, but by the shell and the shell doesn't have root
access.

The following would work:

	cat /dev/null | sudo sh -c "cat - > /var/log/apache2/error.log"

Or to avoid the useless use of cat, you could do:

	sudo sh -c "cat -> /var/log/apache2/error.log" < /dev/null

Or:

	sudo sh -c " > /var/log/apache2/error.log"

Alexander Skwar
-- 
They just buzzed and buzzed...buzzed.




More information about the ubuntu-users mailing list