Connecting through SSH
Connecting Polytomic to MySQL through SSH
If your MySQL instance requires an SSH connection, we recommend you generate a Polytomic-only SSH key pair. The steps below describe how to do this for Ubuntu environments.
- Create a user account for Polytomic.
ubuntu@ip-10-0-5-194:~$ sudo adduser polytomic --disabled-password
Adding user `polytomic' ...
Adding new group `polytomic' (1001) ...
Adding new user `polytomic' (1001) with group `polytomic' ...
Creating home directory `/home/polytomic' ...
Copying files from `/etc/skel' ...
Changing the user information for polytomic
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n]
- Switch to the Polytomic user and generate an SSH key pair.
ubuntu@ip-10-0-5-194:~$ sudo su polytomic
polytomic@ip-10-0-5-194:/home/ubuntu$ cd ~
polytomic@ip-10-0-5-194:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/polytomic/.ssh/id_rsa):
Created directory '/home/polytomic/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/polytomic/.ssh/id_rsa
Your public key has been saved in /home/polytomic/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:ofESkNzrFipL3Dq39csjkHoFg3my2UDPuOEPVGO22IA polytomic@ip-10-0-5-194
The key's randomart image is:
+---[RSA 3072]----+
| . ..o |
|E o B.. |
| . & oo.. |
| X O o= . |
| + @ *o.S |
| X * +. |
| . B +. |
| = +..o. |
| +.. .+o |
+----[SHA256]-----+
The file /home/polytomic/.ssh/id_rsa
will now contain the SSH private key needed for Polytomic to connect.
- Authorize the public key for the
polytomic
user.
polytomic@ip-10-0-5-194:~$ cd ~/.ssh/
polytomic@ip-10-0-5-194:~/.ssh$ cp id_rsa.pub authorized_keys
- Create a new MySQL connection in Polytomic. Tick the 'Connect over SSH Tunnel?' box to reveal SSH configuration fields.
-
Fill in the SSH configuration fields. Paste the contents of your private key file (
/home/polytomic/.ssh/id_rsa
in our example above) into the 'Private key' text field. -
Click 'Save'.
Updated about 3 years ago