5

scp to AWS EC2 - error - "Please login as the user "ubuntu" rather than the user "root"."

view full story
linux-howto

http://serverfault.com – I'm trying to scp a file to /var/www because I'm playing with apache. To move the file I do scp -i <ec2-shh-key> localfile ubuntu@<ec2-instance-ip>:/var/www/fileremote. But this gives me an error: Please login as the user "ubuntu" rather than the user "root". How can I solve this problem? EDIT: I have discovered this superuser question which answers the question by first scp'ing the file to a non-sudo dir, then passing a sudo mv command over ssh to move the file. Is there no way to do this in one step with just scp? (HowTos)