Configuration¶
This page shows where the SFTP service's configuration lives, how to add users, and how to let clients on your network connect.
Where configuration lives¶
| Path | What it is |
|---|---|
/opt/sushi/etc/sftp/sshd_config |
The SFTP service's configuration. The host's own SSH configuration is separate and unchanged. |
/etc/ssh/sftp-authorized-keys/<user> |
Each user's authorized public key. |
/var/lib/sushi-sftp/jails/<user> |
Each user's folder. Owned by root, mode 0755. |
/var/lib/sushi-sftp/jails/<user>/incoming |
The one folder the user can write to. |
/var/lib/sushi-sftp/customer/ |
The transfer user's key pair, created on first boot. root only. |
/var/lib/sushi-sftp/hostkeys/ |
The SFTP service's own host key. |
The main settings in sshd_config:
Port 2222andListenAddress 127.0.0.1.AllowGroups sftpusers: only members ofsftpuserscan sign in.PasswordAuthentication noandPermitRootLogin no.- For
sftpusers:ChrootDirectory /var/lib/sushi-sftp/jails/%u,ForceCommand internal-sftp -d incoming,DisableForwarding yes, and keys from/etc/ssh/sftp-authorized-keys/%u.
Add a user¶
Ask your partner for their public key, an OpenSSH line starting with
ssh-ed25519, ssh-rsa or ecdsa-sha2-nistp256. Copy it to the instance,
then run the helper with a new user name:
The helper:
- creates the user in group
sftpusers, with no shell, - creates
/var/lib/sushi-sftp/jails/vendorand itsincoming/folder, - installs the key as
/etc/ssh/sftp-authorized-keys/vendor.
User names are 3 to 32 characters of lowercase letters, digits or hyphens. The helper refuses system accounts and any existing account that is not already a managed SFTP user, and it refuses a file that contains a private key.
The new user can sign in straight away. No restart is needed.
Replace a user's key¶
Run the helper again for the same user with the new public key. It replaces the authorized key and keeps the account and its files.
Accept connections from your network¶
The service listens on 127.0.0.1 only. To let clients in your VPC connect:
-
Add a second
ListenAddressline with the instance's private address to/opt/sushi/etc/sftp/sshd_config: -
Check the configuration:
-
Restart the SFTP service:
-
In the security group, allow TCP 2222 only from the client address ranges that need it.
Clients then connect with:
Give your partners the host key fingerprint, from
sudo ssh-keygen -lf /var/lib/sushi-sftp/hostkeys/ssh_host_ed25519_key.pub,
so they can check it on first connection.
Warning
Do not open port 2222 to 0.0.0.0/0, turn on password authentication,
or give SFTP users a shell such as /bin/bash.
Keep the folders safe¶
OpenSSH only allows a user's folder as a chroot if every part of its path is
owned by root and not writable by anyone else. Keep
/var/lib/sushi-sftp/jails/<user> owned by root with mode 0755, and let
users write only in incoming/.
Disk space¶
All files are stored on the root volume, and there are no per-user quotas. Size the volume for the largest files you expect, and grow it with EBS if you need more.