Technology Encyclopedia Home >How to remotely log in and transfer files on Debian?

How to remotely log in and transfer files on Debian?

To remotely log in and transfer files on Debian, you can use several methods. One common approach is to use SSH (Secure Shell) for logging in and SFTP (SSH File Transfer Protocol) or SCP (Secure Copy Protocol) for transferring files.

Remote Login with SSH:
SSH allows you to securely log in to a remote Debian system. Here’s how you can do it:

  1. Open a Terminal: On your local machine, open a terminal application.
  2. Use the SSH Command: Type the following command to log in to the remote Debian system:
    ssh username@remote_host
    
    Replace username with your username on the remote system and remote_host with the IP address or domain name of the remote system.

Example:

ssh john@192.168.1.100

File Transfer with SFTP:
SFTP is a secure way to transfer files over an SSH connection. Here’s how you can use it:

  1. Open a Terminal: On your local machine, open a terminal application.
  2. Use the SFTP Command: Type the following command to connect to the remote Debian system via SFTP:
    sftp username@remote_host
    
    Replace username with your username on the remote system and remote_host with the IP address or domain name of the remote system.

Example:

sftp john@192.168.1.100

Once connected via SFTP, you can use commands like get to download files from the remote system and put to upload files to the remote system.

File Transfer with SCP:
SCP is another secure method for transferring files. Here’s how you can use it:

  1. Download a File: To download a file from the remote system to your local machine, use:
    scp username@remote_host:/path/to/remote/file /path/to/local/destination
    
    Replace /path/to/remote/file with the path to the file on the remote system and /path/to/local/destination with the path where you want to save the file on your local machine.

Example:

scp john@192.168.1.100:/home/john/documents/report.txt /Users/localuser/Documents/
  1. Upload a File: To upload a file from your local machine to the remote system, use:
    scp /path/to/local/file username@remote_host:/path/to/remote/destination
    
    Replace /path/to/local/file with the path to the file on your local machine and /path/to/remote/destination with the path where you want to save the file on the remote system.

Example:

scp /Users/localuser/Documents/presentation.pptx john@192.168.1.100:/home/john/presentations/

For cloud-based solutions, Tencent Cloud offers services like Cloud Shell and Object Storage that can facilitate remote access and file transfers. Cloud Shell provides a web-based SSH terminal, while Object Storage allows for secure file storage and transfer.