Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Empty network trashes on Server via the Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Empty network trashes on Server via the Terminal
Authored by: swanksalot on Feb 12, '04 11:43:30AM

I get permission denied when I try this (even with sudo invoked).



[ Reply to This | # ]
Empty network trashes on Server via the Terminal
Authored by: bradhenry on Feb 12, '04 12:20:14PM

If you are trying to run on mounted filesystems that are not exported as root, sudo (to the root user) won't work.
If all the files are owned by user foo, then sudo -u foo would work.



[ Reply to This | # ]
Run all parts of a pipe as root
Authored by: kiwi23 on Feb 13, '04 06:16:54PM

If you want to run the whole pipe as root, not only the part leading up to the | (pipe) symbol, then you need to do

sudo /bin/bash -c '<your commands here>'

for the original command line it would read

sudo /bin/bash -c 'find /Volumes/ -name "Trash Can #*" -print0 | xargs -0 rm -Rf'

This is because the shell will split the command line at the | so that the sudo will only see the first part. The commands following the | will be run under your account, not under sudo's control. The solution presented runs a whole shell as root. This shell then runs both commands of the pipe as root.



[ Reply to This | # ]