remote-backups.comremote-backups.com
Contact illustration
Sign In
Don't have an account ?Sign Up
Documentation

SSH users

Your datastore has one main SSH login, customer<ID>. It sees every folder and every key you add to it. If you back up several clients into the same datastore, for example as an MSP, give each client its own SSH user instead. A user has its own SSH keys and can only reach the folders that you choose. It works with SFTP, rsync and Borg.

The login of a user is your main login, a dot and the user name: customer<ID>.client-a. It connects to the same host as the main login.

Add a user

Open your datastore, go to Settings and select SSH / SFTP. Below the main SSH keys, click Add user. Enter a name with lowercase letters, digits and -, for example client-a. Paste the client's public SSH keys, one per line.

Under Folders, expand sftp, borg or rsync and tick the folders the user may use. A ticked folder includes everything below it. To add a folder, click the folder icon next to its parent. A folder that does not exist yet is created when you click Save. The table then shows the login to give to your client.

What a user can do

A user can read and write in its folders. It cannot see the other folders. The folders above its own are read-only, so it cannot create files next to them. It can run the same commands as the main login (ls, du, rm, mkdir and the others), but not zfs. The main login keeps full access to all folders, including the folders of your users.

Main login User
Login customer<ID> customer<ID>.<name>
Folders All Only the ticked folders
SFTP, rsync, Borg Yes Yes, in its folders
Proxmox Backup Server Yes No, use credentials

Connect as a user

Replace customer<ID>, <host> and the user name with your values. The client keeps its private key. You only add its public key.

Connect with the sub-user's login and its private key:

sftp -i /path/to/client-key customer<ID>.client-a@<host>

The session starts in /data, which is your sftp folder. The user sees only the folders that you ticked, for example /data/acme. Its granted borg and rsync folders show under /borg and /rsync. FileZilla, WinSCP and other graphical clients work the same way: enter the full login as the user name.

rsync paths start inside your rsync folder. For a user with the folder rsync/acme/daily, write to acme/daily/:

rsync -avz -e "ssh -i /path/to/client-key" /srv/backup/ customer<ID>.client-a@<host>:acme/daily/

A write to any other folder fails with "Read-only file system".

Put the repository inside a granted folder. For a user with the folder borg/acme:

export BORG_RSH="ssh -i /path/to/client-key"
borg init --encryption=repokey customer<ID>.client-a@<host>:./borg/acme/repo
borg create customer<ID>.client-a@<host>:./borg/acme/repo::{now} /path/to/files

Borg refuses a repository path outside the user's folders.

Change or remove a user

Click the edit icon to change a user's keys or folders. The change applies to the next login. Click the delete icon to remove a user. Its login stops at once. Its folders and files stay in the datastore, and the main login can still use or delete them.