SSH on a Mac
Articles,  Blog

SSH on a Mac


Hi, this is Andrew at 20i, and today we’re going to
be looking at how we enable SSH on a hosting package here and then connect to
it via a macOS-based device. So enabling SSH isn’t too difficult: all we need
to really be concerned about is generating a public key on the Mac
device – macOS-based device. So firstly we just want to go to ‘Manage Hosting’ and
then we want to ‘Manage’ the package that we wish to do this for. Once we’ve done
so we then just want to scroll down and then under ‘Security’ we should be able to
see ‘SSH Access’. Once you’ve clicked that we should then be able to see a page ‘SSH
access’ and then we should be prompted to add a new public key. The public key is
generated on the macOS-based device. As mentioned at the start of the video this
isn’t too tricky but if you haven’t done it before it might be slightly
intimidating. In order to go about doing this we need to use a program called
Terminal. Terminal can be found by going to the launch pad or entering
– pressing – ‘command-space’ on your keyboard and entering ‘terminal’. Here
we’re just going to go to launchpad and then we’ll type in ‘terminal’. Once we’ve
done that we should then see a window like this. Generating a public key isn’t too
difficult: all we need to do is enter a command. The command in question is
‘ssh-keygen’. So here we need to type in SSH-hyphen-keygen. Once we’ve done that
we then just want to hit ‘enter’. This will then prompt us for a location in which
we wish to save the public and private key that were generating for this video
we just want to keep that as the default so all we want to do here is hit ‘enter’. It will then prompt us for a passphrase
you can enter if you wish to do so for security
reasons it’s beneficial it just means that when you’re connecting via SSH
you’ll then be prompted for a passphrase. For this video we’re not going to enter
a passphrase but if you do enter one when you connect
by SSH later on in the video you will just be prompted for that passphrase. So
we just hit ‘enter’ there and then we hit ‘enter’ again. Once we’ve done that it
should then say that our key has been generated. As you can see here it’s
saying that the public key that we need specifically has been generated that uses 20i/.ssh/id_rsa.com. So
all we need to do here we just need to copy this and then we need to output
that file so we can actually get the key. So all we want to do is ‘cat’ and
then once we’ve done that we just then paste and then if you hit ‘enter’ that
should then output the contents of that file. So as you can see here this is the
key at SSH RSA and then down to where it says ‘local’ or whatever the hostname of
your macbook is or macOS-based device. So now that we have the key – the public
key specifically – all we want to do is copy that and then we need to go back to
the My.20i control panel. So we just need to go here and as I say now
that we have the key we just want to paste that into the box there. Once
entered it should give you a handle that just determined by that at the bottom
there and the rest should be the key. Once that’s been entered simply hit ‘Add
public key’. If that’s successful you should see the following message in the
top right hand corner of the screen, saying that this SSH key has been added
successfully. Once you get that as the page notes it says that it may take up
to 5 minutes for SSH access to be processed. However this should usually be instantaneous. If we want to go ahead and connect now all we need to do is enter the following
into a terminal window preceded by the SSH command. So copy this and we want to
go back to the terminal window that we just had open so go back to Terminal and
from this point to connect via SSH simply enter ‘ssh’ and then paste that
which we just copied on the SSH access page. So for me this would be SSH and
we’re searching as the user 20isupport.com so just the name of the
package to the ssh.stackcp.com server. So this is just ‘ssh [email protected]’. Once we’re happy hit enter. We should then be prompted with
the following. Simply enter the word ‘yes’ and now once we’ve done that we should
then see that we’ve successfully connected to the SSH server as we can
see here and we are then free to use SSH access to manage files, directories
etc., on the package. For example we can then see the directories and files that
are in that particular folder that we SSH-to. SSH access is useful for a number
of reasons but it essentially just gives you more freedom in terms of managing
your files and directories on a hosting package. We hope this has been helpful. If
you have any issues or any questions please do get in touch of our support
team.

Leave a Reply

Your email address will not be published. Required fields are marked *