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

How to remotely log in and transfer files on CentOS?

To remotely log in and transfer files on CentOS, you can use several methods. One of the most common ways is by using SSH (Secure Shell) for remote login and SFTP (SSH File Transfer Protocol) or SCP (Secure Copy Protocol) for file transfers.

Remote Login with SSH

SSH allows you to securely access a remote computer. Here’s how you can use it:

  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 CentOS machine:
    ssh username@ip_address
    
    Replace username with your actual username on the CentOS machine and ip_address with the IP address of the CentOS machine.

Example:

ssh john@192.168.1.100

File Transfer with SFTP

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

  1. Open a Terminal: On your local machine, open a terminal application.
  2. Use SFTP Command: Type the following command to connect to your CentOS machine via SFTP:
    sftp username@ip_address
    
    Replace username and ip_address as described above.

Example:

sftp john@192.168.1.100

Once connected, you can use commands like get filename to download files from the remote machine and put filename to upload files to the remote machine.

File Transfer with SCP

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

  1. Download a File:

    scp username@ip_address:/path/to/remote/file /path/to/local/destination
    

    Example:

    scp john@192.168.1.100:/home/john/documents/report.txt /Users/localuser/Documents/
    
  2. Upload a File:

    scp /path/to/local/file username@ip_address:/path/to/remote/destination
    

    Example:

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

Recommended Cloud Service

For enhanced security and scalability, consider using cloud services like Tencent Cloud’s CVM (Cloud Virtual Machine). Tencent Cloud offers secure SSH access and file transfer capabilities through its console and APIs, making it easier to manage your CentOS instances remotely.

By using these methods, you can efficiently log in and manage files on your CentOS system from anywhere.