Technical Anshu
Tutorials Blog
User Management

One SFTP Server for Many Users With a Group Match Block

The second SFTP user is easy. The twentieth exposes every shortcut you took with the first. One group, one config block and one repeatable routine keep a growing user list boring - which is the goal.

By Technical AnshuUbuntu Server7 minute read
Watch the complete Ubuntu SFTP server setup step by step in the video

Everything in this series scales through a single idea: transfer users belong to one group, sftpusers, and the server config speaks to the group, never to individuals. New person? Create the account, add it to the group, make their folder, done - no config edit, no restart, no exceptions to remember.

Terminal - the five command new user routine
$ sudo adduser priya
$ sudo usermod -aG sftpusers priya
$ sudo mkdir -p /srv/sftp/priya/uploads
$ sudo chown root:root /srv/sftp/priya
$ sudo chown priya:sftpusers /srv/sftp/priya/uploads
Run these five, in this order, for every new transfer user. The routine never touches sshd_config, so it cannot break the users who already work.
1

Why the Group Carries the Whole Design

The jail guide in this series ends the config with a Match Group sftpusers block. Because the block matches the group, it automatically governs everyone you ever add to it: the same jail shape, the same transfer-only rule, the same logging. Individual Match User blocks are the trap to avoid - ten users means ten blocks, ten chances to typo, and no two accounts behaving alike by the end of the year.

2

The New User Routine, Exactly

  1. sudo adduser priya - create the account with its password
  2. sudo usermod -aG sftpusers priya - membership switches on the jail and the transfer-only rule at her next login
  3. sudo mkdir -p /srv/sftp/priya/uploads - her jail folder and its writable inside folder
  4. sudo chown root:root /srv/sftp/priya - the jail path obeys the root-ownership rule the jail depends on
  5. sudo chown priya:sftpusers /srv/sftp/priya/uploads - the one folder she can write to
  6. Test her login yourself before telling her it is ready

The %u in the config's ChrootDirectory /srv/sftp/%u expands to each username, so this single pattern serves every account without names appearing in the config at all.

3

Keys and Passwords at Scale

Each user should have their own key, installed into their own authorized_keys, for the same reason each has their own account: removal becomes surgical. When a person leaves, the offboarding is two moves - sudo usermod -L priya to lock the account today, and deleting her key line - not a shared-password change that disturbs the whole office. Keep a simple register of who has an account and why; the day you cannot explain an account is the day to disable it and see who calls.

4

Keep the Register, Review It Monthly

User lists rot quietly: contractors finish, staff change roles, test accounts outlive their tests. A monthly ten minute review - list the group with getent group sftpusers, compare against the register, disable what nobody claims - is the cheapest security control in this entire series. Growth is fine; unexamined growth is how a forgotten account becomes somebody else's door.

Watch the Full Video

See the whole Ubuntu SFTP setup done live, with the exact clicks and commands, in the Technical Anshu video.

Watch Full Video
Frequently Asked Questions

Do I need to restart SSH when I add a user?

No. Group membership and folders take effect at the user's next login, and the Match Group block already covers them. Restarts are only for config file changes, and this routine makes none.

Can two users share one folder instead of personal jails?

They can, using a shared group folder with group write access, but shared space ends individual accountability in the logs. Keep personal jails as the default and add a shared folder only where the team genuinely works on the same files.

A user left the company. What exactly do I remove?

Lock the account immediately, remove their key from authorized_keys, and keep their uploaded files until your retention period passes. Delete the account fully only after anything they owned has a new owner.

This guide is based on the Technical Anshu Ubuntu SFTP server video - Stuck on a step? Ask in the video comments and you will get a reply.