Nov 4, 2017
0
Level 11
How to: Generate and Install SSH key so server A can access server B
I know this is really simple but I always get confused by the order of the process, so I'd like a record of it - and incase anyone else comes across this it may help them too.
I have a Forge server set up as a Redis cache/session/queue server.
I need to access the Redis server from my Laravel app which is on another Forge server.
What are the steps and commands for generating an SSH key on the Laravel server and installing it on the Redis server, so that I may access the Redis server via my Laravel app?
Here's what I came up with. Please correct me if I'm wrong.
SSH into the Laravel server and cd into the .ssh directory
cd ~/.ssh
Generate a new key
ssh-keygen -t rsa
Name the key file
redis_rsa
Open the public key file...
cat redis_rsa.pub
...then select it and copy it to the clipboard.
Login to Forge
Select the Redis server from your list of servers
Click on SSH Keys in the left sidebar
Under the Add Key section:
- Enter the server name (Laravel App) in the name field
- Paste the cert into the textarea
- Click Add Key button
- Done!
Please or to participate in this conversation.