Copy a file to remote server which can't be directly accessed

I want to copy a file from my Ubuntu Desktop(user:vverma) to a server named fb3, please guide me regarding how to scp this?

In order to reach fb3, i have to follow these steps:-

  1. ssh to server1 as user1 from my terminal
  2. ssh from server1 to server2 as user1
  3. sudo su - user2
  4. ssh from server2 to server3(which is fb3) as user2

Now please guide me that how can i accomplish this complicated tsak without creating any errors.


I have always did it like this:

rcp filaname usernameinserver@server:path/in/server

The command will ask you for your password on the server (unless you are using another authentication schema).

Note that your user name in the local computer is not relevant.

rcp/scp are tunneled under ssh, it's probably the most secure way to copy a file. If you want increased security you can try to use key pars instead of passwords. It's more complicated to setup but after it's done you don't need to type your password for each transfer.


there is absolutely no reason to be paranoid about ssh/scp, why should you be? It's safe.

scp myfile user@ip_or_server_name:path/to/myfile

path can be either relative or absolute

I assume that you have already generated your keys (ssh-keygen) and copied to your server (ssh-copy-id).