# Setting up SFTP access for multiple users

> Give several people secure SFTP access to your hosting files using extra SSH keys instead of sharing one login.

Source: https://helpcenter.ruachost.com/getting-started/your-account/setting-up-sftp-access-for-multiple-users/

SFTP (SSH File Transfer Protocol) is a secure way to transfer files between your local computer and your Ruachost hosting account. Unlike FTP, SFTP encrypts both commands and data, protecting your credentials and files during transfer.

By default, a shared hosting account only includes **one SSH login** (your main cPanel/hosting username). This can be limiting if you want to give multiple users secure file transfer access without sharing your main password. The solution is to set up **individual SSH key pairs** for each user.

## Why Use SFTP Instead of FTP?

- **Security**: All traffic is encrypted.
- **No password sharing**: Each user can have their own SSH key.
- **Granular access**: You can restrict users to specific directories.
- **Compatibility**: Works with most FTP clients (FileZilla, Cyberduck, WinSCP).

## Steps to Set Up SFTP for Multiple Users

### Step 1: Generate an SSH Key Pair for Each User

Each user should generate their own SSH key pair on their local machine.

- **Linux/macOS**:

  ```
  ssh-keygen -t rsa -b 4096
  ```

  This creates a private key (`id_rsa`) and a public key (`id_rsa.pub`) in `~/.ssh/`.
- **Windows**: Use **PuTTYgen** or **OpenSSH** in PowerShell to generate keys.

```
⚠️ Important: The private key stays with the user. Only the public key is uploaded to Ruachost.
```

### Step 2: Deploy the Public Key to Ruachost

1. Log in to your Ruachost Hosting Panel.
2. Navigate to **Security → SSH Access**.
3. Add the user’s **public key** (`id_rsa.pub`) to the authorized keys.
4. Assign the user to the appropriate directory (optional, for restricted access).

### Step 3: Configure the FTP Client

Each user must configure their FTP client to use their private key.

#### Example: FileZilla

1. Open **FileZilla**.
2. Go to **Edit → Settings → Connection → SFTP**.
3. Click **Add key file** and select the private key (`id_rsa`).

   - If prompted, FileZilla will convert the key into a supported format.
4. Go to **File → Site Manager**.
5. Create a new site entry:

   - **Host**:  (or server IP)
   - **Port**: 22 (or custom SSH port, e.g., 7822)
   - **Protocol**: SFTP – SSH File Transfer Protocol
   - **Logon Type**: Normal
   - **User**: your Ruachost username
   - **Password**: leave blank (since you’re using keys)
6. Click **Connect**.

## Security Tips

- Never share your private key.
- Use a **passphrase** when generating keys for extra protection.
- Remove unused keys from your Ruachost account to prevent unauthorized access.
- Consider restricting users to specific directories if they don’t need full access.
