← Volver al blog

How to Set Up SFTP for Secure File Transfer

  • Xernode
  • 1 min de lectura
  • 4 de abril de 2026
Security ssh sftp security linux file transfer

Introduction

SFTP (SSH File Transfer Protocol) is a secure way to transfer files to and from your server. This guide shows you how to enable and use SFTP on your Linux VPS.

Step-by-step Guide

  1. Ensure OpenSSH is installed and running
    • sudo apt update
    • sudo apt install openssh-server
    • sudo systemctl start ssh
    • sudo systemctl enable ssh
  2. Check SFTP access (default with SSH)
    • SFTP is enabled by default with OpenSSH.
    • Test SFTP connection from your local machine:n
      • sftp user@your_server_ip
    • Replace user and your_server_ip with your actual username and server IP.
  3. (Optional) Restrict SFTP access to specific users
    • Edit the SSH config file:n
      • sudo nano /etc/ssh/sshd_config
    • Add at the end:n
      • Match User sftpusern
        • ForceCommand internal-sftp
        • PasswordAuthentication yes
        • ChrootDirectory /home/sftpuser
        • PermitTunnel no
        • AllowAgentForwarding no
        • AllowTcpForwarding no
        • X11Forwarding no
    • Save and exit.
  4. Restart SSH to apply changes
    • sudo systemctl restart ssh
  5. Transfer files using SFTP
    • From your local machine:n
      • sftp user@your_server_ip
    • Use commands like putgetlscdexit inside the SFTP prompt.

Recommendations

  • Always use strong passwords or SSH keys for SFTP users.
  • Restrict SFTP access for better security.
  • Regularly monitor file transfers and user activity.

Call To Action

eed a secure VPS for your file transfers? Check out our hosting plans! https://xernode.com/#pricing

Related Guides