How to Configure Debian SFTP Only User
You set up a debian sftp only user by locking the account to file transfers in OpenSSH. You also trap that account inside a root folder so it cannot run shell commands. Most teams start by making a basic Linux group for file transfer users. When teams skip strict rules, users can read system files or run shell scripts. Broad rights turn a simple file drop into a major risk for your servers. How a debian sftp only user works in OpenSSH OpenSSH handles both shell logins and file transfers over
User Provisioning (SCIM) + End-to-End Encryption: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
You set up a debian sftp only user by locking the account to file transfers in OpenSSH. You also trap that account inside a root folder so it cannot run shell commands. Most teams start by making a basic Linux group for file transfer users. When teams skip strict rules, users can read system files or run shell scripts. Broad rights turn a simple file drop into a major risk for your servers.
How a debian sftp only user works in OpenSSH
OpenSSH handles both shell logins and file transfers over the same port. When a user logs in, the SSH daemon checks its rule file for matches. You can match a specific user or a whole Linux group. Once matched, the daemon forces the session to run the internal file transfer server. It blocks the normal login shell right away.
Next, the daemon locks the user into a set root folder. The root folder itself must belong to the root account. No other user or group can have write rights on that top folder. If permissions are too loose, OpenSSH refuses the login right away. Inside that locked folder, admins create a sub-folder where the user can write files.
Teams also disable port forwarding and screen sharing for these accounts. Otherwise, a user without a shell could still tunnel network traffic through the server. OpenSSH lets you turn off these extra channels inside the same match block. You can also use OpenSSH certificates to sign user keys with a CA key. A signed certificate holds the public key, identity info, principal names, and login options. This method was added in OpenSSH 5.4 and uses a simpler format than X.509.
Why static SSH rules are hard to manage at scale
Native OpenSSH rules work well when you only have one or two servers. They decide who can log in and which root folder they see. Still, static rules on each host create big operational gaps as your team grows. You have to edit text files and fix folder rights on every single machine. One wrong owner on a parent directory breaks logins for everyone in that group.
Local accounts also leave long-lived keys sitting on disk across your fleet. If a contractor leaves, you must hunt down and remove their key everywhere. Even if you sign keys with a CA, you must track validity windows carefully. More importantly, basic host rules only check identity at login time. They do not give you central visibility into which files users read or overwrite. They also cannot mask sensitive data like emails or card numbers inside transferred files.
User Provisioning (SCIM) + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Managing keys and permissions across hosts
When engineers need to move files or debug a host, shared accounts cause problems. Multiple people often use the same transfer account to push builds or pull logs. When a bad file breaks an app, the system log only shows the shared name. You cannot tell which real person on your team made the change.
To fix this, teams try to sync Linux users across every Debian host. That adds heavy setup work and still leaves permissions open all day. A better path ties every session to a real person from your identity provider. You also want fine control over each action in flight, not just a door check.
Check SSH commands and file transfers on the host
OpenSSH keys and certificates decide who can log into a Linux host. They do not check what a one-shot command or file transfer does once the session starts. With hoop.dev, you run an open-source SSH server with guardrails inline on the host. On every one-shot command or file transfer an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.
When a caller runs a one-shot command or moves a file, hoop.dev guardrails check the command or path before it runs, and hoop.dev data masking masks matched sensitive patterns in downloads and output. Interactive shells carry no guardrails because keystrokes have no statement boundary. Teams can turn interactive shells off and allow only commands and file tasks. The audit trail logs who connected and what was allowed or refused, without storing keystrokes or file bytes. See the source on GitHub.
Frequently asked questions
Why does my Debian SFTP user disconnect right after login?
This almost always happens because the root folder has bad ownership rules. The top folder in the path must belong to root and block others from writing. Create a child folder inside it if the user needs to upload files.
Can an SFTP only user still forward ports through OpenSSH?
Yes, unless you block forwarding in your OpenSSH daemon rules. Limiting the command to file transfers only stops interactive shell sessions. You must explicitly turn off TCP and agent forwarding for that user or group.
Should I use passwords or keys for file transfer users?
Keys and OpenSSH certificates are much safer than passwords for automated or human transfers. With OpenSSH certificates, a CA signs the user key and sets principal names. This lets you verify users without copying static public keys to every host.
Related guides
In this post