> For the complete documentation index, see [llms.txt](https://docs.mikopbx.com/mikopbx/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mikopbx.com/mikopbx/english/faq/setup/change-host/transfer-using-rsync.md).

# Transfer using rsync

A method for transferring MikoPBX to another host using rsync (preferred)

This article discusses transferring data to a new host using `rsync`. This approach uses a generated SSH key for authentication, making it the most reliable and therefore the recommended method.

{% embed url="<https://youtu.be/3BzmLPgjXKk>" %}

Schematically, the transfer process can be depicted as follows:

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FsaTdewXJ4VoAPBTo9p3X%2Fimage.png?alt=media&amp;token=b86b1542-76b2-49a6-aae1-00cbf2d31940" alt=""><figcaption><p>Data transfer scheme</p></figcaption></figure>

## Creating the Script File and Adding Content

1. First, establish an SSH connection to your **new** MikoPBX. You can find instructions on how to do this in [this article](/mikopbx/english/faq/troubleshooting/connecting-to-a-pbx-using-ssh/putty.md).

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2Fst1SB1n4dvN8FESfQFu0%2FsshConnection.png?alt=media&amp;token=053372bd-5168-4e40-8995-88ae3768a5df" alt=""><figcaption><p>Successful SSH connection to the new MikoPBX</p></figcaption></figure>

2. Once connected, switch to the console (**\[9] Console**). First, you need to create a directory to store the script file. Use the following command:

```
mkdir -p /storage/usbdisk1/transfer
```

3. Navigate to the created directory:

```
cd /storage/usbdisk1/transfer
```

4. Create the file "**transfer-rsync.sh**" to store the script:

```
touch transfer-rsync.sh
```

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FFQBQJ5p5tEWDbKIkifaO%2Fimage.png?alt=media&amp;token=52cc6e33-2d41-4a7b-bbf0-05de4d8836b6" alt=""><figcaption><p>Running commands to create a file</p></figcaption></figure>

5. Next, you need to fill the file with the script content. You can find the script [here](https://gist.github.com/excla1mmm/c9891306b459cac0c7ea3c785ab0936e).

Use the following command to download the script:

```php
curl -o /storage/usbdisk1/transfer/transfer-rsync.sh https://gist.githubusercontent.com/excla1mmm/c9891306b459cac0c7ea3c785ab0936e/raw/ec57ab60ee48112b4a16635e7b47955e5a044513/transfer-rsync.sh
```

## Running and Using the Script

1. Make the file executable:

```php
chmod +x transfer-rsync.sh
```

2. Run the script:

```php
./transfer-rsync.sh
```

3. You will be prompted to enter necessary information about your old MikoPBX:

* IP address of your old station
* Username for SSH authentication
* Port for SSH authentication

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FgFDZQJQavpQx3ypJFMP3%2Fimage.png?alt=media&amp;token=06178bed-96cb-4467-b8c0-cfc3c6385f94" alt=""><figcaption><p>Entering the required data</p></figcaption></figure>

4. Next, you’ll be asked whether to generate a new key. If you haven’t done this before, type "y" to confirm. If you previously generated a key for accessing the second MikoPBX, type "n":

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FGSz4sOs2fPm7DZmkJ1wN%2Fimage.png?alt=media&amp;token=0124d7b0-8c53-499c-9d36-95d86b4e3093" alt=""><figcaption><p>Generating a new key</p></figcaption></figure>

5. A new SSH key will be created. You must copy this key and insert it into the web interface of your old MikoPBX at **General Settings** → **SSH** → **SSH Authorized keys** field.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FjIpnKPYhcOSFWQcO8uTV%2Fimage.png?alt=media&amp;token=d74b66a8-f707-4cdf-abc8-e57ab550233d" alt=""><figcaption><p>Generated ssh key</p></figcaption></figure>

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FRDlulHLP2Ej1Cmw3piUE%2FSshAuthorizedKeysField.png?alt=media&amp;token=5ed131db-c0ca-4c46-8a7b-90ddfbd8012d" alt=""><figcaption><p>Inserted key</p></figcaption></figure>

6. After saving the key on the old MikoPBX, wait a few seconds, then press any key to continue the script.

The transfer of all data to the new host will begin. This may take some time.

{% hint style="danger" %}
After the transfer, always verify the integrity of all data before retiring the old MikoPBX!
{% endhint %}

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FeseDSbkGKxQebcP98GwB%2Fimage.png?alt=media&amp;token=57646273-f5ca-40a5-9b75-d626b88605c2" alt=""><figcaption><p>Successful transfer</p></figcaption></figure>


---

# 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.mikopbx.com/mikopbx/english/faq/setup/change-host/transfer-using-rsync.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.
