Benefits of remote server

server dev

How to Use Linux SFTP Control to Transfer Files

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

In Comparison to the FTP protocol, SFTP provides All FTP, also its functionality is a lot easier to configure.

Unlike The sftp command permits you to carry out a range of operations on remote files and resume file transfers.

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

remote server

Before you Begin

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

When It’s recommended to conduct the Sftp command within a screen or tmux session.

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

Establishing an SFTP link

SFTP works on a model. It’s a subsystem of SSH and supports all SSH authentication mechanisms.

Although the traditional password authentication is set up By default and easier in the event that you connect to your server via SSH/SFTP it is recommended to make SSH keys and set up a SFTP login.

To start an SFTP connection use the sftp Command followed by the distant server username and the IP address or domain name:

If You’re connecting to a remote server Authentication password.

You’ll Be presented with the sftp prompt, once connected, And you can begin interacting with the remote machine:

Connected to ip_or_hostname.

sftp>

If the SSH server is not listening to the default Jack 22, use the -oPort option to specify the alternate port:

Sftp -oPort=custom_port remote_username@server_ip_or_hostname

SFTP Commands

Most of the SFTP controls are similar or equal to the You would use prompt.

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

help

Available commands:

bye Quit sftp

directory to ‘path’

Version Show SFTP version

! command Execute ‘command’ in local shell

! Escape to local shell

? Synonym for help

Navigating with SFTP

When you are logged in to the remote server Working directory is the user home directory. You can check that by scanning:

pwd

Remote directory: _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 change to the /tmp directory you would type:

cd /tmp

The above commands are Utilized to navigate and operate on the Remote site.

The sftp shell also provides commands for local navigation, Information and document management. The regional commands are prefixed with the letter l.

For example, to print the local directory, you’d Type:

cd lpwd

Local directory: /home/local_username

Transferring Files with SFTP

You can transfer files securely machines.

You can use a GUI, if you are currently working on a desktop machine SFTP client such as WinSCP download or upload files and or FileZilla to link to the remote server.

The sftp command is useful when you work on a server without GUI, and you want to transfer files or carry out other operations on the files that are remote.

Downloading Files

Once you are logged into the server, your present Working directory is your user directory that is remote.

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

To download a single file in the server Get control:

get filename.zip

The output should look something like this:

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

100% 24MB 1.8MB/s 00:13

If You Would like to save the file using another Name, specify the name as the second argument:

Zip

To download a directory in the remote system, use the recursive -r option:

Get -r remote_directory

It with the reget command.

Author: Manuel Schmidt