# Setting up Subversion (SVN) access for multiple users

> Give several people Subversion (SVN) access to one shared hosting account with SSH keys, without sharing your password.

Source: https://helpcenter.ruachost.com/developers/version-control/setting-up-subversion-svn-access-for-multiple-users/

**Setting up Subversion (SVN) access for multiple users**\
Learn how to set up Subversion (SVN) access for multiple users on a single Ruachost shared account.

**Setting up Subversion access for multiple users**\
Subversion clients use SSH to access repositories on Ruachost servers. Shared hosting accounts, however, only provide a single SSH login, which makes sharing access with multiple users challenging. You don’t want to share your account password with other users.

The solution is to create a separate SSH key pair for each user. SSH keys do not require passwords, allowing users to access your repositories safely. You can also revoke access for a specific user without affecting others.

## Main steps

1. Each user creates an SSH key pair and sends the public key to the account owner. The owner adds the public key to the account’s `~/.ssh/authorized_keys` file.
2. Each user configures their Subversion client to use the private key to access the repositories.

**Setting up Subversion tunneling**\
Using the steps above gives users full shell access, which can be a security risk. All repository changes (commits) would also appear under the same account username. To prevent this, you can configure SVN tunneling. This restricts shell access per key and allows individual SVN usernames to track commits.

## Steps to configure SVN tunneling

1. Log in to your account using SSH.
2. Open the `~/.ssh/authorized_keys` file in a text editor.
3. Locate the key for the user whose access you want to restrict.
4. Add the following to the start of the key line:

```
command="svnserve -t --tunnel-user=svnname -r /home/username/repository",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty
```

- Replace `svnname` with the SVN username to assign to the user. Commits will be recorded under this name.
- Replace `username` with your Ruachost account username and `repository` with the path to the repository. The `-r` option sets a virtual root directory, preventing access above the repository.

**Example**\
For a user named `kelly`, the line might look like this (key data shortened for readability):

```
command="svnserve -t --tunnel-user=kelly -r /home/username/myrepo",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty ssh-rsa AAsaAPi1T…bdrU29eQ user@localhost
```

5. Save the changes to `~/.ssh/authorized_keys`.

Users can now access repositories without full shell access. For example, a user can list the repository contents using their Subversion client without specifying the full server path.
