Joey BagODonuts Asked: 2010-12-18 09:23:47 +0800 CST2010-12-18 09:23:47 +0800 CST 2010-12-18 09:23:47 +0800 CST ssh -> authorized_keys 772 sudo cat idenityfile.rsa > authorized_keys -bash: authorized_keys: Permission denied if I su - to the user then I can do this but why can I not do this with sudo from my user? ubuntu ssh 2 Answers Voted Best Answer wag 2010-12-18T09:33:10+08:002010-12-18T09:33:10+08:00 The > redirection does not work like this with sudo. You can use these alternative: sudo sh -c 'cat idenityfile.rsa > authorized_keys' Michael Jensen 2010-12-18T09:31:40+08:002010-12-18T09:31:40+08:00 It is because the redirect isn't "sudo"ed Try something like this instead: sudo bash -c “cat idenityfile.rsa > authorized_keys”
The
>
redirection does not work like this with sudo.You can use these alternative:
It is because the redirect isn't "sudo"ed Try something like this instead:
sudo bash -c “cat idenityfile.rsa > authorized_keys”