How to Configure Amazon Linux SFTP Only User
You set up an amazon linux sftp only user by locking the account to a single folder. You also block full shell access in the SSH daemon rules. Many teams create standard server accounts for file transfers at first. Those broad accounts let users run shell commands and read system files. A locked account stops users from moving outside their assigned folder. How an amazon linux sftp only user works Amazon Linux uses the OpenSSH daemon to handle both shell logins and file transfers. By default,
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 an amazon linux sftp only user by locking the account to a single folder. You also block full shell access in the SSH daemon rules. Many teams create standard server accounts for file transfers at first. Those broad accounts let users run shell commands and read system files. A locked account stops users from moving outside their assigned folder.
How an amazon linux sftp only user works
Amazon Linux uses the OpenSSH daemon to handle both shell logins and file transfers. By default, a new user account can open an interactive shell and browse the server. To limit the user, you first create a dedicated group for file transfer accounts. Next, you create the user account and disable its normal login shell. You then set up a chroot directory that acts as the new root folder.
OpenSSH has strict ownership rules for this root folder. The root account must own the top folder, and no other user can write to it. Inside that top folder, you create a subfolder where the user can write files. Finally, you update the SSH daemon rules to match the transfer group. This rule forces the built-in SFTP subsystem and locks the session inside the root folder. It also turns off port forwarding and terminal access for that group.
Managing keys and permissions across hosts
Once the folder lock is in place, you still need to manage user keys. Standard public keys sit on the server until someone removes them by hand. OpenSSH also supports signed user certificates, which arrived in OpenSSH 5.4. A Certification Authority key signs a user public key to create a certificate. This certificate holds a public key, identity details, principal names, and a set of options. It uses a simpler format than standard TLS certificates.
Even with certificates, local server rules must stay in sync across every machine. Each server needs the right local groups, folder owners, and SSH daemon entries. If an admin sets wrong folder permissions during an update, the login fails right away. Worse, a missed group rule can give a transfer user a full shell again.
User Provisioning (SCIM) + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native SFTP restrictions leave open
Locking a user to SFTP solves the problem of interactive shell access on one host. It decides who logs in and which folder they see on that disk. Still, local SSH rules do not solve identity management across many servers. Admins still have to copy public keys or sync local user accounts on every host.
Native setups also leave a gap in visibility and day-to-day control. Standard server logs show when a user logs in or disconnects from the host. They do not give central teams a single view of active sessions across fleets. They also cannot ask a manager to approve a sensitive session before it starts. When someone leaves the team, admins must clean up keys on every single server.
Add command and file guardrails to SSH access
Host firewalls and certificate principals control who opens an SSH session. Yet an allowed user or agent can still run a bad one-shot command or pull sensitive files over sftp. In practice, hoop.dev sits inline on the host as an open-source SSH server with guardrails that uses OpenSSH certificates. For every one-shot command or sftp task an agent or human runs in production, hoop.dev decides to pass, mask, block, or escalate it for review.
Using hoop.dev SSH controls, guardrails check one-shot commands, env variable names, and sftp or scp paths before they run. Port forwards default to deny unless the target is listed. Because interactive shells have no statement boundary and carry no guardrails, teams can turn them off so every command is checked and logged. Check out the MIT-licensed project on GitHub.
Frequently asked questions
Why does my SFTP user disconnect right after logging in?
OpenSSH drops the connection if the chroot folder has wrong permissions. The root user must own the top folder, and group write access must be off.
Where can an SFTP only user upload files?
Since root owns the top chroot folder, the user cannot write directly inside it. You must create a writable subfolder inside the chroot path for their uploads.
Can an SFTP only user still use SSH keys to log in?
Yes, key login works the same way for restricted file transfer accounts. The SSH daemon checks the authorized keys file before locking the session to the folder.
Related guides
In this post