# SSH

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/help/ruby/2026.3/llms.txt).

> **TL;DR**
> Add SSH configurations: `Settings | Tools | SSH Configurations`
>
>
>
> Start an SSH session from the main menu: `Tools | Start SSH Session`
>
>
>
> Configure SSH terminal: `Settings | Tools | SSH Terminal`

RubyMine allows you to work with remote machines using SSH. You can create predefined SSH configurations and use them to run [remote SSH sessions](#start_ssh), configure a [remote Ruby
interpreter](configuring-language-interpreter.html#ssh_remote_interpreter), or [connect to databases](configuring-ssh-and-ssl.html#ssh).

## Set up SSH

Before working with remote machines using SSH, make sure that SSH access is enabled on a remote server. You can use several authentication methods, for example:

* Use a remote host's username and password for authentication.

* Generate the SSH public/private key pair on your local machine and add the public key to the remote host.

* If the SSH public/private key pair exists on your local machine and the public key is uploaded to the remote host, you can add the private key to the [ssh-agent](https://linux.die.net/man/1/ssh-agent).

## Add an SSH configuration

You can create the predefined SSH configurations and reuse them within a specific project or across all your projects. To create a new SSH configuration, follow the steps below:

Procedure:

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Meta+Comma` (TextMate), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Tools | SSH Configurations`.

2. Click the ![Add](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.add.svg) button to add a new configuration.

3. If you do not want to share the configuration between projects, make sure that the Visible only for this project option is enabled.

4. Specify the required parameters depending on the Authentication type.

![SSH configuration settings](https://resources.jetbrains.com/help/img/idea/2026.3/rm_ssh_configuration.png)

Password:

* Host/Port: The hostname/IP address and port used to connect to a remote machine.

* Username: The username used to authenticate on a remote machine.

* Authentication type: In this field, select the Password value to authenticate a user with a password.

* Password: Specify a password used to access a remote machine.

Key pair:

* Host/Port: The hostname/IP address and port used to connect to a remote machine.

* Username: The username used to authenticate on a remote machine.

* Authentication type: In this field, select Key pair.

* Private key file: Specify a path to a private key file stored on a local machine.

* Passphrase (optional): Specify a passphrase used for the specified private key.

Authentication agent:

* Host/Port: The hostname/IP address and port used to connect to a remote machine.

* Username: The username used to authenticate on a remote machine.

* Authentication type: In this field, select OpenSSH config and authentication agent to use ssh-agent running on a local machine.

5. Configure connection parameters.

* Send keep alive messages every: Send regular packets to keep the SSH connection active. Without regular messages, the remote server might close the connection. Set the message period in seconds.

* Strict host key checking: Specify how to handle new and changed host keys. * Yes: Never add new host keys to the user's known_hosts file and never allow connections to hosts with changed host keys. * Accept New: Always add new host keys to the user's known_hosts file but never allow connections to hosts with changed host keys. * No: Always add new host keys to the user's known_hosts file and allow connections to hosts with changed host keys. * Ask: Add new host keys to the user's known_hosts file only after confirmation and never allow connections to hosts with changed host keys. This is the default behavior.

* Hash hosts in known_hosts file: Store new host records in hash format.

6. Click OK.

## Supported OpenSSH directives

When you use OpenSSH config and authentication agent, RubyMine reads your SSH configuration files. Choose how to read them in `Settings | Advanced Settings | SSH | Configuration files parser`.

The default OpenSSH option requires OpenSSH on your computer and runs `ssh -G` to read the configuration. RubyMine then applies the settings supported by its SSH implementation, not every OpenSSH feature.

The Legacy option uses the parser built into RubyMine, which supports the following directives:

* [AliveInterval](https://man.openbsd.org/ssh_config#ServerAliveInterval)

* [ClearAllForwardings](https://man.openbsd.org/ssh_config#ClearAllForwardings)

* [Compression](https://man.openbsd.org/ssh_config#Compression)

* [ConnectTimeout](https://man.openbsd.org/ssh_config#ConnectTimeout)

* [ForwardAgent](https://man.openbsd.org/ssh_config#ForwardAgent)

* [ForwardX11](https://man.openbsd.org/ssh_config#ForwardX11)

* [ForwardX11Trusted](https://man.openbsd.org/ssh_config#ForwardX11Trusted)

* [GSSAPIAuthentication](https://man.openbsd.org/ssh_config#GSSAPIAuthentication)

* [HashKnownHosts](https://man.openbsd.org/ssh_config#HashKnownHosts)

* [Host](https://man.openbsd.org/ssh_config#Host)

* [Hostname](https://man.openbsd.org/ssh_config#Hostname)

* [IdentitiesOnly](https://man.openbsd.org/ssh_config#IdentitiesOnly)

* [IdentityAgent](https://man.openbsd.org/ssh_config#IdentityAgent)

* [LocalForward](https://man.openbsd.org/ssh_config#LocalForward)

* [PreferredAuthentications](https://man.openbsd.org/ssh_config#PreferredAuthentications)

* [ProxyCommand](https://man.openbsd.org/ssh_config#ProxyCommand)

* [RemoteForward](https://man.openbsd.org/ssh_config#RemoteForward)

* [ServerAliveCountMax](https://man.openbsd.org/ssh_config#ServerAliveCountMax)

* [StrictHostKeyChecking](https://man.openbsd.org/ssh_config#StrictHostKeyChecking)

* [UserKnownHostsFile](https://man.openbsd.org/ssh_config#UserKnownHostsFile)

* [XAuthLocation](https://man.openbsd.org/ssh_config#XAuthLocation)

> **Note:**
> With the Legacy parser, `ForwardAgent` takes effect only when the `ssh.agent.forwarding` registry option is enabled. This option is enabled by default.

## Start an SSH session

To start an SSH session on a remote host, follow the steps below:

Procedure: Start an SSH session

1. Go to `Tools | Start SSH Session…`.

2. If you already have existing [SSH configurations](#add_ssh_config) or running [Vagrant instances](vagrant.html#ssh), select the desired one in the invoked popup.

![Select Host to Connect](https://resources.jetbrains.com/help/img/idea/2026.3/rm_ssh_select_host.png)

You can also choose Edit credentials to specify credentials manually.

3. (Optional) If you selected Edit credentials, specify the required parameters depending on the Authentication type, as described in [Add an SSH configuration](#add_ssh_config).

![SSH Session dialog](https://resources.jetbrains.com/help/img/idea/2026.3/rm_ssh_session_dialog.png)

4. A new SSH session is opened in a separate tab.

![SSH terminal](https://resources.jetbrains.com/help/img/idea/2026.3/ssh_session_terminal.png)

To close the SSH session, click ![the Close button](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.closeSmall.svg) on the terminal toolbar or right-click the current session tab and select Close Tab from the context menu.

> **Tip:**
> Learn more about the RubyMine terminal emulator from [Terminal](terminal-emulator.html).

Procedure: Configure SSH terminal setting

You can configure the following SSH terminal settings on the `Tools | SSH Terminal` page of the Settings dialog `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Meta+Comma` (TextMate), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)):

* Connection settings

Choose one of the following:

* Current Vagrant: Select this option to [connect](#start_ssh) to the running Vagrant instance.

* SSH configuration: Select the existing [SSH configuration](#add_ssh_config) to [connect](#start_ssh) it to every time, or choose Select SSH configuration on every run to invoke the popup with available servers when executing `Tools | Start SSH Session…`.

* Default encoding

Select the desired encoding to be used in the SSH terminal.

## See also

### Procedures

[Add a remote interpreter](configuring-language-interpreter.html#add_remote_ruby_interpreter)

