# SSH Access for Magento CLI, database and media

## Generating your SSH Key and Getting Public Key

### Linux

{% hint style="info" %}
**xclip** must be installed to generate SSH keys on Linux. Check if you have it installed by running the following command in the terminal:

`where xclip`
{% endhint %}

For version >= Ubuntu 20.04

`which clip`

If the output is nothing then you don't have it installed. Install it by entering the following command in the terminal:\
`sudo apt install xclip`

1. Generate the SSH key by entering the following command in the Terminal window:\
   `ssh-keygen -t rsa`
2. When you execute this command, the ssh-keygen utility prompts you to indicate where to store the key.
3. Type in a passphrase. You can also hit the ENTER key to accept the default (no passphrase).
4. After you confirm the passphrase the system generates the key pair.
5. Your private key is saved to the *id\_rsa* file in the .ssh directory. Do not share it with anyone.
6. Your public key is saved to the *id\_rsa.pub* file. You can copy it by running this: `xsel -b < ~/.ssh/id_rsa.pub`

### Mac

1. Generate the SSH key by entering the following command in the Terminal window:\
   `ssh-keygen -t rsa`
2. When you execute this command, the ssh-keygen utility prompts you to indicate where to store the key.
3. Type in a passphrase. You can also hit the ENTER key to accept the default (no passphrase).
4. After you confirm the passphrase the system generates the key pair.
5. Your private key is saved to the id\_rsa file in the .ssh directory. Do not share it with anyone.
6. Your public key is saved to the id\_rsa.pub file. You can copy it by running this: `pbcopy < ~/.ssh/id_rsa.pub`

### Windows

Follow these [instructions](https://phoenixnap.com/kb/generate-ssh-key-windows-10).

## Add SSH User

{% hint style="danger" %}
**SSH access doesn't allow you to make code-level changes including enabling or disabling extensions.** Perform code changes by following instructions [here](/project-development/code-customization-and-local-setup.md) and enable/disable extensions by following instructions [here](/project-development/extension-installation.md).
{% endhint %}

1. Log into your User Portal account by following [these instructions](https://help.readymage.com/user-portal/user-portal-access). &#x20;
2. In the instance drop-down, select the instance for which you would like to create SSH access.&#x20;
3. If you plan to use a single SSH key for multiple instances, [follow this guide](https://help.readymage.com/application-management/ssh-access#using-account-ssh-key-integration-preferred-way).
4. To add SSH access for a single instance, [follow this guide](https://help.readymage.com/application-management/ssh-access#using-ssh-key).<br>

## Remove SSH User

1. Log into your User Portal account by following [these instructions](https://help.readymage.com/user-portal/user-portal-access).&#x20;
2. In the instance drop-down, select the instance from which you would like to remove SSH access.
3. Open the `SSH Access` section.&#x20;
4. Click the red delete button next to the username to remove access.

## Connect to SSH using terminal

{% hint style="info" %}
If you are not using Terminal to connect to SSH then you might require to enter:\
Host: *ssh.ireland.eu.i.readymage.com* (EU Ireland region)\
&#x20;         *ssh.stockholm.eu.i.readymage.com* (EU Stockholm region)\
&#x20;         *ssh.ohio.us.i.readymage.com* (USA Ohio region)\
&#x20;         *ssh.central.ca.i.readymage.com* (Canada Central region)\
&#x20;         *ssh.central.me.i.readymage.com* (Middle East UAE region)\
&#x20;         *ssh.sydney.ap.i.readymage.com* (Asia Pacific Sydney region)\
Port: *22*
{% endhint %}

1. Log into your User Portal account by following the instructions [here](/user-portal/user-portal-access.md).
2. Select the instance you would like to SSH connect to.
3. Open the SSH Access tab under the Application Management section.
4. Press copy next to your Username to copy the command.
5. Paste the command into Terminal and hit enter.

## SSH Usage

{% hint style="danger" %}
**SSH access doesn't allow you to make code-level changes including enabling or disabling extensions.** Perform code changes by following instructions [here](/project-development/code-customization-and-local-setup.md) and enable/disable extensions by following instructions [here](/project-development/extension-installation.md).
{% endhint %}

### Magento CLI

The list of Magento CLI commands can be found [here](https://devdocs.magento.com/guides/v2.4/reference/cli/magento.html).

### MySQL CLI

Instructions to create a database dump, download the database dump locally, and replace the database on your instance can be found [here](/project-development/database-and-media-migration.md).

### Media management

Instructions to create download media locally or replace media on your instance can be found [here](/project-development/database-and-media-migration.md).

### Additional tools

File compressing tools:

* gzip
* tar
* unzip
* zcat
* zip
* dar

Other useful tools:

* curl
* git
* grep
* head
* jq
* ping
* pv
* tail
* tmux
* wget


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.readymage.com/project-development/ssh-access-for-magento-cli-database-and-media.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
