A Guide to Your FTP Server with SSH Secure Setup

February 5, 2026 ARPHost Uncategorized

If you've heard an IT pro talk about setting up an "FTP server with SSH," what they're almost always referring to is SFTP, which stands for SSH File Transfer Protocol. This isn't just a minor tweak to old-school FTP; it’s a modern replacement that tunnels all file operations through an encrypted Secure Shell (SSH) connection, usually over a single, secure port.

Why SFTP Is the Modern Standard for Secure File Transfers

Let's be blunt: the days of sending sensitive data in plain text are over. Traditional FTP, a relic from the 1970s, has no place in a modern IT environment. It completely lacks the security needed to protect information from being intercepted or altered. This is where SFTP comes in, and it's a non-negotiable upgrade for any secure server.

Unlike its predecessor, SFTP is an entirely different protocol built for security from the ground up. It piggybacks on the same SSH connection system admins use for remote shell access, which gives it several powerful advantages:

  • End-to-End Encryption: Every single thing—commands like listing directories, the file data itself, and your login credentials—is fully encrypted. This makes it impossible for an attacker to sniff out your password or sensitive files.
  • Simplified Firewall Management: SFTP does everything over a single port, typically port 22. This is a massive relief compared to FTP and FTPS, which require a messy range of ports for command and data channels, creating firewall headaches.
  • Robust Authentication: Forget simple passwords. SFTP natively supports public-key cryptography, a far more secure method that makes brute-force attacks practically useless.

SFTP vs FTP vs FTPS A Quick Comparison

It's easy to get the acronyms mixed up, but the differences are critical. This table breaks down why SFTP stands out as the clear winner for modern, secure file transfers.

FeatureSFTP (FTP over SSH)Traditional FTPFTPS (FTP over SSL/TLS)
Underlying ProtocolSecure Shell (SSH)File Transfer ProtocolFTP with SSL/TLS encryption layer
EncryptionFull encryption for both commands and dataNone. Everything is sent in plain text.Encrypts commands and/or data, but can be complex
Port UsageSingle port (usually 22) for all trafficTwo ports/channels (command and data)Multiple ports, often requiring complex firewall rules
AuthenticationPassword, Public Key (highly secure)Password (insecure)Password, Client/Server Certificates
Firewall FriendlinessVery high. Easy to configure with one open port.Low. Requires opening a range of ports.Medium. Can be difficult to configure behind a NAT firewall.
Setup ComplexitySimple. Part of the standard OpenSSH server.Simple (but insecure)Complex. Requires managing SSL/TLS certificates.

As you can see, SFTP combines the best of both worlds: the simplicity of a single-port protocol with the ironclad security of SSH.

The Clear Choice for Data Integrity and Compliance

This isn't just about following trends; it’s a market-driven necessity. Secure protocols like SFTP are seeing the fastest growth as businesses scramble to lock down their data. Market analysts project that these secure methods will dominate the market, driven by the urgent need to close the glaring security holes left by older protocols. You can explore detailed reports on FTP solution growth to see the data for yourself.

This intense focus on encryption is a cornerstone of modern cyber security best practices. It's what ensures data integrity and helps your organization stay compliant with strict regulations like HIPAA and GDPR.

By running on top of the trusted SSH protocol, SFTP gives you a single, secure, and reliable channel for both system administration and file management. This consolidation simplifies your server's architecture and dramatically shrinks its attack surface.

Ultimately, choosing SFTP means building your file transfer system on a foundation of security from day one. This is exactly the philosophy behind managed hosting, where security isn't an afterthought. Platforms like ARPHost's Secure Web Hosting Bundles are built to provide this hardened environment right out of the box, saving you the hassle of manual configuration and potential missteps.

Configuring Your First SFTP Server on a Linux VPS

Setting up an FTP server with SSH—which is really SFTP—is a bread-and-butter skill for anyone managing servers. Let's walk through a real-world configuration from scratch on a Linux VPS. The process is pretty clean, especially on a fresh system like one of ARPHost's High-Availability VPS Hosting plans, which spin up KVM-based servers ready for you to command.

We'll start with the essentials: creating a dedicated user and group just for file transfers, then locking down the OpenSSH service to handle their connections securely.

Initial Server Prep and User Setup

Before you start editing config files, the first order of business is always to get your system's package list current. This simple step heads off potential conflicts and makes sure you have the latest security patches installed.

sudo apt update && sudo apt upgrade -y

With the system updated, our next move is to create a dedicated group for SFTP-only users. This is a smart strategy because it lets you apply specific rules to a whole class of users at once, rather than tweaking individual profiles every time.

sudo addgroup sftpusers

Now, let's create a new user and pop them into our sftpusers group. We're also going to set their shell to /usr/sbin/nologin. This is a critical security move that blocks them from getting an interactive shell prompt if they try to log in with a standard SSH client.

sudo useradd -m -g sftpusers -s /usr/sbin/nologin transferuser

Finally, give this new user a strong password.

sudo passwd transferuser

This simple user-and-group foundation is all you need to build a secure and easy-to-manage SFTP environment.

Modifying the OpenSSH Configuration File

The heart of your SFTP server lives in the sshd_config file, which you'll typically find at /etc/ssh/sshd_config. Before you touch anything, it's an absolute best practice to make a backup. Trust me, it gives you an instant "undo" button if a typo locks you out.

sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak

Now, open the configuration file with your favorite text editor, like nano or vim.

sudo nano /etc/ssh/sshd_config

You need to find the Subsystem sftp line and make a change. By default, it usually points to /usr/lib/openssh/sftp-server. We're going to switch this to use the internal-sftp subsystem. This version is built right into OpenSSH and gives us finer control for things like chroot jails, which we'll get to in a minute.

Just comment out the original line and add the new one below it:

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

This diagram shows how the data flows securely from the client, through an encrypted SSH tunnel, and lands safely on your server.

As you can see, SFTP keeps everything tidy by funneling all communication through a single, encrypted channel. This makes both security and firewall management much simpler.

Applying Group-Specific Rules

With the new subsystem in place, the final step is to add a block of rules at the very end of the sshd_config file. This is where we put that sftpusers group to work, forcing anyone in it into an SFTP-only mode.

Add these lines to the bottom of your file:

Match Group sftpusers
    ForceCommand internal-sftp
    PasswordAuthentication yes
    ChrootDirectory %h
    AllowTcpForwarding no
    X11Forwarding no

So what does all this do? Let's break it down:

  • Match Group sftpusers: This tells OpenSSH that the rules below only apply to users in the sftpusers group. Simple.
  • ForceCommand internal-sftp: This is the real workhorse. It forces the connection to immediately launch the internal SFTP server, completely bypassing any shell access. They can't run any other commands.
  • PasswordAuthentication yes: For now, this lets our users log in with their password. You can (and should) switch this off later when you set up SSH key authentication.
  • ChrootDirectory %h: This is a powerful one. It locks the user inside their home directory (%h is just a shortcut for that). They can't browse the rest of the filesystem—they can't even see it exists.
  • AllowTcpForwarding no and X11Forwarding no: These disable advanced SSH features like tunneling and graphical forwarding, which shrinks the potential attack surface even further.

Finalizing and Testing the Configuration

Once you've saved the changes to sshd_config, you need to check the file for syntax errors before you restart the service. It’s a quick sanity check that can save you from getting locked out of your own server.

sudo sshd -t

If that command gives you no output, you're golden—the syntax is correct. Now you can safely restart the OpenSSH service to make the changes live.

sudo systemctl restart sshd

That's it! Your SFTP server is now active. You can test it by connecting with a client like FileZilla or WinSCP using the transferuser credentials. You'll be able to upload and download files, but any attempt to get a shell prompt will fail. This setup provides a secure, isolated foundation for all your file transfers.

For those who want to get their hands dirty with more advanced server management, our guide on the best unmanaged VPS hosting is a great next step for taking full control of your environment.

Isolating Users with Chroot Jails for Enhanced Security

Close-up of a monitor displaying 'CHROOT JAIL' with a padlock and linked file icons on a teal screen.

Forcing an SFTP-only connection is a solid first step, but real security in a multi-user ftp server with ssh means completely boxing users in. You simply can't have a partner or client accidentally (or intentionally) poking around sensitive parts of your server’s filesystem, like /etc or /var.

This is exactly where a chroot jail becomes one of the most critical tools in your security toolkit.

The idea is simple yet incredibly powerful: a chroot jail effectively changes a user's root directory (/) to a specific path you define. Once they log in, they are blind to anything outside that designated folder. It's like putting them in a virtual room where every door leads back inside—they are well and truly jailed.

Getting Chroot Directory Permissions Right

Setting up a chroot jail is fairly straightforward, but it comes with one specific rule that trips up even experienced admins all the time. The entire directory path leading up to and including the chroot directory itself must be owned by the root user and cannot be writable by anyone else.

Forgetting this tiny detail is the number one cause of SFTP connection failures after you enable ChrootDirectory. Users will get a vague "connection closed" or "broken pipe" error, leaving you to puzzle over what went wrong.

Let’s map out a compliant—and functional—directory structure for our transferuser:

  • /home/transferuser: This is our chroot jail. It must be owned by root.
  • /home/transferuser/uploads: This is a subdirectory inside the jail. This folder can be owned by transferuser, giving them a space to actually write files.

This two-layer setup satisfies OpenSSH's strict security rules while still giving the user a practical workspace.

A Step-by-Step Configuration Example

Building on our last section, let's create this secure directory structure. We already set ChrootDirectory %h in our sshd_config, which points to the user's home directory. Now, we just need to nail down the permissions.

First, take ownership of the user's home directory and assign it to root.

sudo chown root:root /home/transferuser

Next, create the writable subdirectory inside their home folder and give them ownership of it.

sudo mkdir /home/transferuser/uploads
sudo chown transferuser:sftpusers /home/transferuser/uploads

Finally, lock down the permissions. The root-owned jail shouldn't be world-writable, and the user-owned folder needs the right read/write access.

sudo chmod 755 /home/transferuser
sudo chmod 755 /home/transferuser/uploads

Once you've made these changes, a quick restart of the SSH service will apply them.

sudo systemctl restart sshd

Now, when transferuser logs in, they'll land in their home directory, see only the uploads folder, and can only read and write files within that specific folder. This is the kind of granular control that defines enterprise-grade security.

This focus on user isolation aligns with broader security frameworks. In fact, understanding the principles of Identity and Access Management (IAM) is vital for managing user privileges effectively, which directly reinforces the security provided by chroot jails. The global SSH Server Software market reflects this demand, valued at USD 1.2 billion in 2024 and projected to hit USD 2.8 billion by 2033, with large enterprises making up nearly 60% of the market due to their complex IT security needs.

Why ARPHost Excels Here
Manually configuring chroot jails and troubleshooting permissions for every single user gets tedious and is ripe for human error. ARPHost's Secure Web Hosting Bundles automate this entire process. We use solutions like CloudLinux OS, which provides a virtualized file system for each user by default. This delivers superior isolation and security without any of the manual legwork, ensuring your multi-user environments are secure from day one.

For those managing their own VPS, mastering chroot is a powerful skill. But for businesses that value efficiency and guaranteed security, a managed solution is a clear winner.

Ready to deploy a server with advanced security built-in? Explore our Secure VPS Bundles at arphost.com/vps-web-hosting-security-bundles/ and let our experts handle the complexities for you.

Implementing Passwordless Logins with SSH Keys

Close-up of a laptop displaying code, with a 'SSH KEYS' sticker, a physical key, and a security token on a wooden desk.

Passwords are, without a doubt, the single weakest link on any server exposed to the internet. Automated bots are constantly hammering login prompts, running through dictionary attacks and brute-force attempts to guess a weak password. The best way to slam that door shut for good is to move to public-key cryptography—a far superior authentication method for your ftp server with ssh.

SSH keys operate in pairs: you get a public key that lives on the server and a private key that you guard closely on your local machine. When you try to connect, the server presents a challenge encrypted with your public key. Only your private key can solve it. This cryptographic handshake is nearly impossible to break, making password-guessing bots completely useless.

Generating Your SSH Key Pair

First things first, this process starts on your local computer, not the server. Whether you're on Linux, macOS, or Windows using WSL, you can create a powerful key pair with one command. I highly recommend using the Ed25519 algorithm; it delivers an excellent blend of top-tier security and performance.

Pop open your terminal and run this command:

ssh-keygen -t ed25519 -C "[email protected]"

The system will ask you a couple of questions:

  1. File to save the key: Just hit Enter to accept the default path (like /home/youruser/.ssh/id_ed25519). It's the standard, and it's where other tools expect to find it.
  2. Enter a passphrase: While optional, I strongly advise setting one. Think of it as a password for your private key, adding one more crucial layer of security. If your laptop is ever compromised, the attacker still can't use your key without this passphrase.

This command generates two files in your ~/.ssh/ folder: id_ed25519 (your private key, which you should never share) and id_ed25519.pub (your public key).

Deploying the Public Key to Your Server

With your keys ready, the next step is to get the public key onto your server. The easiest and most reliable way to do this is with the ssh-copy-id utility. It handles everything—copying the key, creating the right directory, and setting the correct file permissions automatically.

Use this command, but be sure to swap transferuser and your-server-ip with your actual username and server address:

ssh-copy-id -i ~/.ssh/id_ed25519.pub transferuser@your-server-ip

You'll be prompted for your user's password one last time. Once you enter it, ssh-copy-id will append your public key to the ~/.ssh/authorized_keys file on the server. Now, try logging in again. You should get in without a password prompt (though you'll need to enter your key's passphrase if you set one).

Disabling Password Authentication Completely

Now for the final, most important step. With key-based logins confirmed to be working, it's time to disable password authentication on the server entirely. This is what truly secures your machine against brute-force attacks.

Let's open the sshd_config file on your server again:

sudo nano /etc/ssh/sshd_config

Look for the PasswordAuthentication line. It might be commented out with a # or set to yes. You'll want to change it so it explicitly reads no:

PasswordAuthentication no

Important Pro-Tip: Before you restart the SSH service, open a second terminal window and log in with your SSH key. This is your safety check. If something went wrong with your key setup, this prevents you from accidentally locking yourself out of your own server.

Once you’ve verified your key works in a new session, you're clear to restart the SSH service and make the change permanent.

sudo systemctl restart sshd

That's it. Your server will now only accept connections authenticated with a valid SSH key, massively improving your security posture. This kind of robust authentication hardening is a core part of ARPHost's managed IT services. Our experts handle complex security protocols for our clients every day, delivering enterprise-grade protection without the headache. For a truly hands-off approach to server security, request a managed services quote and let us take care of it for you.

Hardening Your SFTP Server with Advanced Techniques

Alright, you've got user isolation and SSH keys dialed in. Your ftp server with ssh is looking pretty solid. But if this server is destined for a production environment, we can't stop there. True hardening is about layering defenses—creating a tough, resilient setup that can shrug off automated attacks and protect against the unexpected.

This is where we move past the standard SSH tweaks and start thinking like security pros. It’s about building a fortress at the network and application levels. These next steps are what separate a decent setup from an enterprise-grade, bulletproof server.

Locking Down Access with a Firewall

First things first: the firewall. This is your server's bouncer, deciding who even gets to knock on the door. A properly configured firewall ensures that only legitimate SFTP traffic ever reaches your SSH daemon, stopping countless attacks before they even start.

For most Linux flavors, you'll be working with either ufw (Uncomplicated Firewall) on Debian/Ubuntu or firewalld on CentOS/RHEL systems. The strategy is simple: block everything by default, then poke a tiny hole just for what you need—in this case, SSH traffic on port 22.

  • For ufw users:
    sudo ufw allow OpenSSH
    sudo ufw enable
    
  • For firewalld users:
    sudo firewall-cmd --permanent --add-service=ssh
    sudo firewall-cmd --reload
    

With those commands, you've massively shrunk your server's attack surface. To get a deeper understanding of crafting robust firewall rules, check out our complete guide on configuring firewalls for Linux.

Thwarting Brute-Force Attacks with Fail2ban

Even with password authentication disabled, you can bet that automated bots will relentlessly hammer your server, sniffing for any weakness. This is where Fail2ban becomes your best friend. It's a clever little tool that watches your server's logs for repeated failed login attempts and then automatically blocks the offending IP addresses at the firewall.

Getting it running is a breeze:

  1. Install Fail2ban:
    sudo apt install fail2ban # For Debian/Ubuntu
    sudo yum install fail2ban # For CentOS/RHEL
    
  2. Create a local configuration file. This prevents your changes from being overwritten during updates.
    sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
    
  3. Enable the SSH jail. Open /etc/fail2ban/jail.local with your favorite editor and make sure the [sshd] section is active:
    [sshd]
    enabled = true
    
  4. Start and enable the service so it runs on boot:
    sudo systemctl enable --now fail2ban
    

That's it. Now, any IP that tries to brute-force its way in gets a temporary timeout, stopping those attacks cold.

For mission-critical infrastructure, this level of layered security is non-negotiable. On ARPHost's Dedicated Proxmox Private Clouds, you have the full control to implement these advanced hardening techniques across your entire network, from the hypervisor to individual VMs. We provide the dedicated hardware and root access; you build the fortress.

Enforcing Stronger Cryptographic Policies

Finally, let's harden the SSH daemon itself. Over time, cryptographic algorithms can be found to have weaknesses. To protect against downgrade attacks where an attacker forces a weaker cipher, we can explicitly tell sshd to only use modern, robust algorithms.

Just add these lines to the bottom of your /etc/ssh/sshd_config file:

KexAlgorithms [email protected],ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256
Ciphers [email protected],[email protected],[email protected]
MACs [email protected],[email protected],[email protected]

This focus on security is why the market for tools like this is growing. The FTP server market is set to climb from USD 794.5 million in 2025 to over USD 1 billion by 2031, a surge driven entirely by the need for secure and reliable data exchange. You can discover more insights about FTP server market growth and see how security continues to shape the industry.

Scaling Your Secure File Transfer with ARPHost

Let's be real. Following a guide to set up an FTP server with SSH is one thing, but keeping it running securely in a business environment is a whole different beast. It's not a "set it and forget it" task.

Properly configuring, hardening, and then constantly monitoring an SFTP server demands real expertise and, frankly, a lot of time. Time that you or your team could be spending on actually growing the business. This is exactly where the DIY approach starts to break down and a managed solution becomes a game-changer.

From Manual Effort to Managed Excellence

Every step we’ve covered, from locking down users in chroot jails to tweaking the SSH daemon, has to be executed perfectly. Just one tiny misconfiguration can swing the door wide open for attackers. That's the day-to-day operational headache that ARPHost's Fully Managed IT Services are built to solve.

Instead of you worrying about the infrastructure, we handle the entire lifecycle for you:

  • Secure from the Get-Go: Our team rolls out your server with all the security essentials—like key-based authentication and airtight firewall rules—already baked in. No guesswork needed.
  • 24/7 Monitoring & Patching: We're constantly on the lookout for threats and applying critical security patches as they emerge. This means no more late-night alerts for your team when a new vulnerability drops.
  • Rock-Solid Backups: We keep your data safe with regular, automated backups, so you can bounce back quickly if anything ever goes wrong.

Shifting to ARPHost lets you offer a powerful, enterprise-grade SFTP service without bogging down your internal IT team. We sweat the small stuff so you can focus on the big picture.

Whether you just need a single secure endpoint or a sprawling, high-performance environment for heavy file transfers, we have you covered. Our flexible VPS hosting plans are a perfect starting point, designed to grow right alongside your business.

And when you're ready to scale up, our solutions—from powerful Bare Metal Servers to Dedicated Proxmox Private Clouds—provide the secure foundation you need to expand without hesitation.

Common Questions About SFTP Setups

Once you start digging into setting up an ftp server with ssh, a few questions almost always pop up. Let's tackle some of the most common ones to clear up any confusion and make sure your server is as secure and straightforward as possible.

Can I Use a Different Port for SFTP?

You absolutely can. By default, the SSH service that powers SFTP listens on port 22. If you want to change it, just open up your /etc/ssh/sshd_config file and edit the Port directive to a new number.

Moving the port is a popular "security through obscurity" trick. It's great for cutting down the constant noise from automated bots scanning the default port 22. But let's be clear: this is not a substitute for real security. A determined attacker will find your open port with a quick scan. Always rely on a properly configured firewall, disabled password logins, and mandatory SSH keys as your primary lines of defense.

What Is the Difference Between SFTP and FTPS?

This is a huge point of confusion, and it's an important one. The two protocols sound similar, but they are completely different animals under the hood.

  • SFTP (SSH File Transfer Protocol): This isn't just FTP with a security layer slapped on. It's a modern protocol designed from the ground up to run over an encrypted SSH connection. It uses a single port for everything—commands and data—which makes it a breeze to configure with firewalls.

  • FTPS (FTP over SSL/TLS): This is the classic, old-school FTP protocol wrapped in an SSL/TLS encryption layer. It still relies on separate channels for commands and data, a quirk that can turn into a real headache when you're trying to get it working behind a NAT firewall.

For nearly every modern use case, SFTP is the simpler, more secure, and more reliable choice.

How Do I Transfer Files to My SFTP Server?

Once your server is up and running, actually moving files is the easy part. You just need a file transfer client that speaks the SFTP protocol, and thankfully, there are fantastic options for every operating system.

  • FileZilla: A true workhorse. It's free, works on Windows, macOS, and Linux, and is probably the most popular client out there.
  • WinSCP: If you're on Windows, this is an incredibly powerful and well-loved client built just for you.
  • Command-Line sftp: For those who live in the terminal, both macOS and Linux come with a native sftp client. It's perfect for scripting automated transfers or just doing a quick upload without a GUI.

Connecting is simple. Just tell your client to use the SFTP protocol, enter your server's address and your username, and then authenticate with your password or, ideally, your SSH private key.


At ARPHost, we take the complexity out of secure file transfers. Our managed solutions are built with security best practices baked in from the start, so you can focus on your business while we handle the infrastructure.

Start with our secure, scalable VPS plans from just $5.99/month.

Tags: , , , ,