up vote 1 down vote favorite
share [g+] share [fb]

I ssh into a ubuntu box with username "ubuntu" and I can become root without entering a password via "sudo su". How can I scp files onto this box using the ubuntu@ username? It does not allow me to do so using root@. The error is:

scp: /etc/...: Permission denied

I can do this same task in rsync by using --rsync-path="sudo rsync" for example.

link|improve this question
You might want to post this on superuser.com instead - that's just like Stack Overflow but precisely for answering this sort of question - you'll get a better response there than here. – Ninefingers Feb 4 '10 at 20:34
feedback

migrated from stackoverflow.com Feb 5 '10 at 1:01

This question came from our site for professional and enthusiast programmers.

2 Answers

As you suggested, use rsync with the sudo trick. scp won't preserve permissions anyway.

link|improve this answer
feedback

You can either SCP them as the user and then log in and copy them as root. Since SCP can't su, there's not a good way to do it unless you change root's password.

(I thought you would have to add PermitRootLogin yes to /etc/sshd/sshd.cofig, but it seems Ubuntu uses the random-root-password method instead of locking out root)

link|improve this answer
feedback

Your Answer

 
or
required, but never shown