Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

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

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

    
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

2 Answers 2

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

share|improve this answer

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)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.