Set up an SSH key

When you want to gain SSH acccess to a server, you need to generate a public/private keypair on your local computer. The private key is stored on your local machine, and should not be shared, while the public key is what you add to your Webdock account, and then assign to your shell users on your servers. Click here to read our article on how to use your Public Key with Webdock.

This article just deals with how you can create an appropriate SSH key on your local machine for use with Webdock.

MacOS / Linux

Setting up SSH keys is easiest on Mac and Linux, and is practically identical. By default, the system adds keys to the /Users/<yourname>/.ssh directory on MacOS and /home/<username>/.ssh on Linux.

From the terminal, enter ssh-keygen at the command line.
The command prompts you for a file to save the key in:

$ ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/yourusername/.ssh/id_rsa): <-- Press the Enter or Return key

You should just accept the default location, unless you have a reason to change it.

You should enter and re-enter a passphrase when prompted, if you want to password protect your key. This is more secure, but adds an additional password prompt whenever you want to log in to your Webdock server. Strictly speaking, the password can be omitted if you feel secure that your local system will not be compromised. You have to weigh convenience vs. risk here.

You can now list the contents of ~/.ssh to view the key files.

$ ls ~/.ssh 
id_rsa id_rsa.pub

To view your public key, which is the one you should copy/paste into the Webdock interface, execute the following command:

$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAjm/8tQdXJ8gXETIOh3h6V+7KPAe+e9OUlBps a55Ky+1Ry1E2unGDDQNGqRVh9gmhL5p27NH0Bfd4kksa6Lm1WTnRirZCvHaVIPQ8 k4RTU73KJ9WnXmEi34hiMbmTjnrKLs+6YqLUqGmyyd/GK3Vs/9JYGhFHzc4qS2wk cmHKKws= mike@mymacbook

Congratulations, you now have your SSH key all set up!

Windows 10 or later

One easy way to achieve this on Windows is to install the Linux subsystem and just run Bash on your windows machine, and then follow the same instructions as for Linux. You should then connect via. SSH through your Bash shell. For more information on how to run Linux on Windows, click here.