How can we help?
Categories
< All Topics
Print

Configuring an SFTP Server on ServerStadium

Introduction

Setting up an SFTP server on ServerStadium (VM Pricing, Dedicated Servers) ensures a secure method for transferring files. This setup is particularly beneficial for businesses and individuals looking to safeguard their file transfers against unauthorized access.

Configuring an SFTP Server on ServerStadium

Prerequisites

Step 1: Select and Prepare Your ServerStadium Server

  1. Choose a Server: Opt for a ServerStadium VM or dedicated server based on your file storage and transfer needs.
  2. Server Setup:

    sudo apt update
    sudo apt upgrade

Step 2: Install and Configure SSH Server

SFTP is part of the SSH server, which is typically installed by default:

  1. Install OpenSSH Server (if not already installed):

    sudo apt install openssh-server

  2. Configure SSH for SFTP:

    Edit the SSH configuration file:

    sudo nano /etc/ssh/sshd_config

    Ensure the following line is present and uncommented:

    Subsystem sftp /usr/lib/openssh/sftp-server

Step 3: Create a User for SFTP

  1. Add a New User for SFTP:

    sudo adduser sftpuser

    Follow the prompts to set up the new user.

  2. Assign a Directory for SFTP User:

    Set up a directory for the SFTP user and restrict permissions:

    sudo mkdir -p /home/sftpuser/files
    sudo chown sftpuser:sftpuser /home/sftpuser/files
    sudo chmod 700 /home/sftpuser/files

Step 4: Restrict SFTP User Access

  1. Restrict SFTP User:

    Modify the SSH configuration to restrict the SFTP user to their directory:

    sudo nano /etc/ssh/sshd_config

    Add the following at the end of the file:

    Match User sftpuser
    ForceCommand internal-sftp
    PasswordAuthentication yes
    ChrootDirectory /home/sftpuser
    PermitTunnel no
    AllowAgentForwarding no
    AllowTcpForwarding no
    X11Forwarding no

  2. Restart SSH Service:

    sudo systemctl restart sshd

Step 5: Accessing the SFTP Server

  1. Connect to SFTP:

    Use an SFTP client with the following details:

    • Host: your_server_ip
    • Username: sftpuser
    • Password: The password you set for sftpuser

    The connection will be on the default SSH port (22).

Conclusion

Your SFTP server is now ready on ServerStadium, offering a secure method for transferring files. For additional support or resources, visit our knowledge base or contact our support team.

Table of Contents