The following knife command works fine (where $z is a variable read in from the command line):
knife ssh name:$z ‘sudo chmod 777 /trashfile’ -x myaccount -i ~/.ssh/mykey.pem -C 3
Now the following command (very similar to the above) fails:
knife ssh name:$z ‘sudo find /file/in/some/path -type f -ctime +3 | xargs -n1 rm -f’ -x myaccount -i ~/.ssh/mykey.pem -C 3
The second command fails with the following error:
“cannot remove /file/in/some/path” permission denied"
Note, I’m using sudo, and the first command works. Why does the second one fail?
Could it be the “pipe” (|)?? If so, is there a way around that?