This guide will help you quickly connect to your Server using SSH. For an extensive tutorial on SSH you can check out this great SSH Essentials tutorial.
In order for you to connect to your server you need to:
Downloading Bunnyshell autogenerated SSH Key pair
Generating a SSH key pair
If you already have a ssh key pair you can skip to the next step.
When you create a new Server Bunnyshell will use by default your Primary ssh key. If you haven't added any ssh keys, a pair will be generated for you. In order to download it go, from the left menu go to Resources -> SSH Keys. Here you can see the key pair that was generated for you and you can download the private key. In order to be able to use the key you will have to assign it the permissions 600 (-rw-------).
chmod 600 <path_to_key>
To generate the keys run the following command:
You will be prompted to answer some generation options and for a passphrase. You can answer with the default options and choose not to use a passphrase by pressing ENTER.
The command will generate a private key and an associated public key that will be stored in your home directory under the
.ssh directory. All directories starting with . are called hidden directories and are visible by adding the
-a parameter to the
ls command. The keys will be stored in the following location:
~/.ssh/id_rsa: The SECRET private key.
~/.ssh/id_rsa.pub: The associated PUBLIC key.
The secret key is like a password and it is important that you do not share it. The public key is like your username so you can communicate it publicly.
In order to gain access to a server with your public ssh key with a certain user, you have to add your public key (.pub file content) to that user's
authorized_keys file on the remote server. If you downloaded you SSH key from Bunnyshell you can skip to the next step as the key is already provisioned on the server
From the right menu choose Resources -> SSH Keys and click Add new Key. Enter a name for your key and paste your public SSH key.
From the Server View go to the SSH/SFTP tab. You can create a new user or use the
bunnyshell default user for connecting to the server. Add your ssh key to the Authorized ssh keys by entering the name used before and click Deploy changes.
You can ask someone that has access to the server to add it or if you have access you can add it yourself.
Use the following command to print your the public SSH key
Connect to the server and add the key to the user's
echo "<public_ssh_key>" >> /home/<user>/.ssh/authorized_keys
By default the above command uses the
.ssh/id_rsa key for authentication. You can use an alternative key by specifying the key path to the
-i (identity_file) parameter.
ssh -i <path_to_private_key> <user>@<ip>