> For the complete documentation index, see [llms.txt](https://docs.spectralink.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.spectralink.net/amie-essentials/maintenance/backup-and-restore.md).

# Backup and restore

Occasionally, the SAM server requires various housekeeping tasks.

{% hint style="info" %}
**Who can access backup files?**

Only an administrator and a user can view backup files. A read-only user will not see the backup files. A user can see the backup files and can download them. Only administrators can use Browse and Backup buttons.
{% endhint %}

## Backup Files and Backup Now

SAM maintains storage space on the SAM server for 10Gb for backup files. The Available Backup Files list displays when you restore the SAM DB from any of the listed files. See Restore SAM from a backup.

Click **Backup Now** to add a new file to this list (deleting the oldest file to make room for the new one, if necessary).

![](https://3032864282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxfLF6IpyutR429bMnvvf%2Fuploads%2Fgit-blob-292fec85120c7e83664a22df298acb91f0dfbd4d%2Fimage41.png?alt=media)

## Back up the SAM data

**Backup Now** on the *About* page will run an immediate backup of critical SAM data. This action will back up the database, the certificates, and the account key. **A backup should be taken before making widespread changes to SAM’s configuration, to provide a recovery path for unintended consequences.**

{% hint style="success" %}
**Back up SAM regularly**

As part of our good housekeeping recommendations, we suggest you devise a regular backup schedule for your SAM data.
{% endhint %}

The backup on demand file is stored in the path /home/sam/uploads/backup. It will be named “backup.year.month.day-hour.minute.second.zip”.

Click **Browse File** to select a SAM backup file. See the steps below.

## Restore SAM from a backup

SAM’s data can be restored from existing backup files on disk or from an uploaded file, brought in from an outside backup location.

{% hint style="info" %}
**When restoring SAM from a backup, the backup file must be from the same version of SAM**

A backup should only be applied to the version of SAM it was derived from. If an administrator attempts to apply a backup from an incompatible version of SAM, a warning will appear and the backup will be prevented.
{% endhint %}

### Enabling/Disabling SSH

{% hint style="info" %}
**SSH is disabled by default**

This section covers how to enable or disable SSH in your deployment.
{% endhint %}

To enhance the security posture of the SAM server, SSH is disabled by default. You can enable or disable SSH in two ways: via the command line, or within the SAM UI.

#### Enabling/Disabling SSH via the command line

To enable SSH via the command line, run the following script:

```bash
./change-state-of-ssh.sh
```

This script toggles SSH on or off. Since SSH is off by default, the first time you run this script SSH will be enabled, and you’ll see this message in the terminal: *Service not running, starting service*. If you run the script again, SSH will be disabled, and the terminal will report *Service is running, stopping service*.

#### Enabling/Disabling SSH from SAM’s About page

![](https://3032864282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxfLF6IpyutR429bMnvvf%2Fuploads%2Fgit-blob-c0d7c1ceed5b75c255558883b9837ed3483313d8%2Fimage43.png?alt=media)

To enable SSH using the SAM UI, go to SAM’s *About* page and click **Switch SSH State**.

This button toggles\
SSH on or off: since SSH\
is off by default, the first time\
you click this button SSH will be enabled. If you click it again, SSH will be disabled. (Note that it takes a few minutes after clicking the button for the toggle to occur when using this approach.)

### Restore to an existing SAM server

1. From the console (or using SSH [if enabled](#enabling-disabling-ssh)), log in (sam/sam) to access the VM host.
2. In the case of restoring from an uploaded file, in the SAM UI click the About SAM icon at the bottom left. Click **Browse File**. From the file section dialog box choose the backup file that you want to restore. Click **Open**. The file should upload while its progress is shown in the UI. This file will have the latest modification date.
3. Apply the backup file. Navigate to the bin directory:

   ```bash
   cd ~/bin
   ```
4. Execute the command:

   ```bash
   ./import.sh
   ```

Example screen:

![](https://3032864282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxfLF6IpyutR429bMnvvf%2Fuploads%2Fgit-blob-b65bb60a6f7da45967bd8455f0ded425506a7b8f%2Fimage44.png?alt=media)

1. Select the backup file from the displayed list by entering its index number. The apply script will begin.
2. When the script messages end, your SAM instance has been restored. It will take up to one minute for the web services to restart.

   If you have a browser tab open to the SAM instance, close it and open a new one. You will be prompted to log in again.

### Restore to a new SAM server

In the extreme case where your VM image becomes corrupted or compromised, it’s possible to install a new VM and import data from the previous instance into it. This is unlikely to be ever needed but can be accomplished relatively easily. Contact Spectralink support for further details.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.spectralink.net/amie-essentials/maintenance/backup-and-restore.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
