Benefits of remote server

The Way to Use Linux SFTP Control to Transfer Files

remote server

SFTP (SSH File Transfer Protocol) is a secure file protocol Used to access, manage, and transfer files.

In Comparison to the conventional FTP protocol, SFTP offers All FTP, also its performance is more easy to configure.

Unlike the scp command, which allows file transfers, The sftp command permits you to carry out a selection of operations on remote files and restart file transfers.

In this tutorial, we will show You How You Can use the Linux sftp command.

Before you Begin

To Have the Ability to move and manage files via SFTP you need to Have write permission on the remote server.

When transferring large files, It’s recommended to run the Sftp command inside a tmux or display session.

The directory from where you run the sftp command will be the Local working directory.

Establishing an SFTP connection

SFTP works on a client-server model. It is a subsystem of Supports and SSH all SSH authentication mechanisms.

Although the password authentication is installed By default and easier if you frequently connect to your server via SSH/SFTP it is suggested to create SSH keys and set up a passwordless SFTP login.

To open an SFTP connection to a remote system, use the sftp Command followed by the remote server username and the IP address or domain name:

If you are connecting to a host with password Authentication password.

You’ll Be presented with the sftp prompt, once joined, And you’ll be able to start interacting with the remote machine:

Connected to ip_or_hostname.

sftp>

If the SSH server Isn’t listening on the default Jack 22, use the -oPort option to define the alternative port:

Sftp -oPort=custom_port remote_username@server_ip_or_hostname

SFTP Commands

The Majority of the SFTP commands are similar or equal to the You would use in the Linux shell prompt.

By typing, you can Find a listing of all SFTP commands that are available help or ? .

help

Available commands:

bye Quit sftp

cd path Change remote

Version Show SFTP version

! local shell

!

? Synonym for help

Navigating with SFTP

When You’re logged in to the remote server Directory is the user home directory that is remote. You can check this by scanning:

pwd

Remote directory: /home/remote_username

To list the files and directories use the ls command:

ls

To navigate to a different directory, use the cd command. For Example, to switch to the /tmp directory you would type:

cd /tmp

The commands are used to navigate and work on the Remote site.

The sftp shell provides commands for navigation that is local, Info and document management. The local orders are prefixed with the letter l.

By Way of Example, to print the working directory that is local, you would Kind:

cd lpwd

Local working directory: _username

Transferring Files

Between two you can move files with SFTP machines.

You can use a GUI if You’re working on a computer SFTP client like FileZilla or WinSCP to connect to the server and download or upload files.

Once You work on a server without the sftp command is helpful GUI, and you want to move files or carry out other operations.

Downloading Files using the SFTP Control

Once you are logged in to the remote server Working directory is the remote user home directory.

When downloading documents the documents are Downloaded to the directory where the sftp command was typed by you.

To download one file in the server Get control:

get filename.zip

The output should look something

Fetching /home/remote_username/filename.zip to filename.zip

/home/remote_username/filename.zip 100% 24MB

If you want to save the downloaded file Name, specify the new name as the second argument:

get filename.zip local_filename. Zip

To obtain a directory in the remote system recursive -r option:

Get -r remote_directory

If a file transfer fails or is interrupted, you can resume The reget command being used by it.