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

How to remotely log in and transfer files on Ubuntu?

To remotely log in to an Ubuntu system and transfer files, you can use several methods. One of the most common ways is by using SSH (Secure Shell) for logging in and SFTP (SSH File Transfer Protocol) or SCP (Secure Copy Protocol) for transferring files.

Logging in Remotely with SSH

  1. Open a Terminal: On your local machine, open a terminal application.
  2. Use SSH Command: Type the following command to log in to your Ubuntu machine:
    ssh username@hostname_or_IP
    
    Replace username with your Ubuntu username and hostname_or_IP with the hostname or IP address of your Ubuntu machine.

Example:

ssh john@192.168.1.100
  1. Enter Password: You will be prompted to enter your password. Type it in and press Enter.

Transferring Files with SFTP

  1. Open a Terminal: On your local machine, open a terminal application.
  2. Use SFTP Command: Type the following command to start an SFTP session:
    sftp username@hostname_or_IP
    
    Replace username and hostname_or_IP as described above.

Example:

sftp john@192.168.1.100
  1. Transfer Files: Once connected, you can use commands like get to download files and put to upload files.
    • To download a file:
      get /path/to/remote/file.txt /path/to/local/directory
      
    • To upload a file:
      put /path/to/local/file.txt /path/to/remote/directory
      

Transferring Files with SCP

  1. Open a Terminal: On your local machine, open a terminal application.
  2. Use SCP Command: Type the following command to copy files:
    • To download a file:
      scp username@hostname_or_IP:/path/to/remote/file.txt /path/to/local/directory
      
    • To upload a file:
      scp /path/to/local/file.txt username@hostname_or_IP:/path/to/remote/directory
      

Example:

scp john@192.168.1.100:/home/john/documents/report.txt /Users/localuser/Documents

Cloud Services Recommendation

For enhanced security and scalability, consider using cloud services like Tencent Cloud. Tencent Cloud offers a variety of services that can facilitate remote access and file transfers, such as Cloud Shell, which provides a secure and convenient way to manage your cloud resources via SSH, and Object Storage CFS (Cloud File Storage), which allows for efficient file sharing and transfer.

By leveraging these tools, you can ensure secure and efficient remote access and file management for your Ubuntu systems.