Originally posted by: hwyguy
One way to do this would be by using sudo on the remote server.
On the remote server, create a Cmnd_Alias in /etc/sudoers to run the rm command with the directory. then create the user alias to allow the non-root user you want to run the command either with a password or without.
The /etc/sudoers entries would look something like this if you wanted to do this without a password prompt:
Cmnd_Alias RM = /usr/bin/rm -r /tmp/myDirectory
yourusername ALL = NOPASSWD: RM
Then on your source host, you would run:
ssh yourusername@destinationhost "sudo /usr/bin/rm -r /tmp/myDirectory"
I would stress that for security reasons, you don't just add the /usr/bin/rm command without the specified directory. Otherwise if someone broke into the yourusername account, they could run the "sudo rm" command to cause mass havoc.
Hope this helps!
#AIX-Forum