How to use sftp on Ubuntu to transfer files to remote server ?

If you have got an SSH/SFTP access to your remote server, but your server doesn’t support SCP, then you will need to use only SFTP to upload or download files from your remote server.

here, lets say you want to upload / transfer README.txt from your /home/myuser/workspace/ to remote host, then first change to this directory,

$ cd /home/myuser/workspace/

Now, access the sftp shell, so we can transfer the files, you can access sftp shell using below command,

$ sftp -oPort=Port_Number [email protected]_ip

Here,

  • if your remote host is using custom port for SSH, then use the same port at the place of “Port_Number”, if your remote host is using default “22” port number, then you can skip “-oPort” option or use “-oPort=22”
  • username – This is the remote host username
  • server_ip – This is the IP address of remote host

once, you use this command, you will get a shell as,

sftp>

Now, lets say your want to upload README.txt to remote server, then just use command, “put README.txt” as,

sftp> put README.txt
Uploading README.txt to /README.txt

Yoy may want to know “FTP Clients for using on Ubuntu”

Leave a Comment