Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have Ubuntu 10.04 running through VMPlayer. And I have another machine (Asus RT-N16 router). I am able to connect to the router with telnet and see its file system. How can I copy the file from the local machine (file is /home/user/helloworld-c) to the router (folder */tmp/mnt/discb_1*)?

share|improve this question
up vote 24 down vote accepted

Is there possibility to connect via SSH? Maybe you should consider "scp" utitlity. It's very simple, look to the manual page:

man scp

The very basic usage:

scp remote_user@remote_host:/path/to/remote/file /path/to/local/file

and vice versa:

scp /path/to/local/file remote_user@remote_host:/path/to/remote/file
share|improve this answer
Thanks, it works! How can I do the same with the whole folder? – LA_ Sep 4 '11 at 8:47
Use "-r" option: scp -r user@host:/path/file /path/local. Please, mark the answer as accepted if it works. – Pavel S. Sep 4 '11 at 9:01
Just look to manual page for scp (in terminal, type "man scp"). There is a lot of more options. – Pavel S. Sep 4 '11 at 9:02
Thank you. It was so tricky. – shgnInc Oct 16 '13 at 15:01
How can I copy folders also with files, this command just copying only files – amit_game Sep 27 '15 at 11:37

To copy a non empty directory from the remote computer to your computer:

scp -r remoteusername@ /home/ourusername/Desktop

To copy a file just exclude the -r option:

scp remoteusername@ /home/ourusername/Desktop

To copy from your computer to the remote computer, just switch the location and destination in the previous example. For more info do man scp.

share|improve this answer

Another way you can do: ( via pem file )

If you want to use pem file and you are ROOT user:

1. root user:

sudo scp -i ~/servers/your-key.pem ~/your-local-source-path/your-local-file.txt root@

note the colon : between server IP and destination path.

if I can't logged in with root user, see step 2.

2. standard user:

suppose you are ubuntu user with standard privileges.

sudo scp -i ~/servers/your-key.pem ~/your-local-source-path/your-local-file.txt ubuntu@

this will put the file in home directory. then login to remote sever with standard user. and do

sudo su

you'll switched to root user. then move the file to destination directory

mv /home/ubuntu/your-local-file.txt /you-server-destination-path/your-local-file.txt

I often encounter this problem, therefore sharing an alternative way to get the job done !

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.