Knowledgebase

How To Disable Root Logins & Replace With SSH Key

How To Disable Root Logins & Replace With SSH Key

The next thing you want to do is disable root logins on your VPS so in order for someone to SSH they must have their RSA key on the server.  This is one sure way to make sure only appropriate users have access to your server.

 To see if you already have an SSH key setup (on a Mac) go to Utilities -> Terminateand type:
cd ~/.ssh

And then:

ls -l

If you see a file called id_rsa.pub then you already have a key, you just need to copy it to your clipboard:

pbcopy < id_rsa.pub

If you don’t, you can easily generate one with the following command in your Mac terminal:

ssh-keygen -t rsa -C "your_email@example.com"

Using your email address allows you to easily be able to identify the SSH key.

Disable Root Logins

Disabling root logins is easy:

  1. Login to Web Host Manager
  2. Click on SSH Password Authorization Tweak under Security
  3. Click the Disable Password Auth button

Import Public SSH Key

You can no longer SSH into your server using the root password, so now you need to import your key into Web Host Manager:

  1. Login to Web Host Manager
  2. Click on Manage root’s SSH Keys under Security Center
  3. Click Import Key
  4. Paste the Public Key in the appropriate box
  5. Click Manage Authorization beside the key
  6. Click Authorize

Then next time you go want to SSH into your box, you shouldn’t have to type a password.  All you need to do is define the port:

ssh -p 5622 root@192.168.1.1 (replace with your server IP)
 
Was this answer helpful?

Related Articles

10 Minute VPS Hosting Setup With WordPress

15 Minute VPS Hosting Setup With WordPress I'll never forget my first dedicated...

Choosing A Web Server For Your VPS Hosting Package

Choosing A Web Server For Your VPS Hosting Package At AppsGators we currently have...

How To Change Your SSH Port

How To Change Your SSH Port Change Your SSH Port In Web Host Manager By default, SSH...

How To Deploy A Cloud Virtual Private Server (VPS)

How To Deploy A Cloud Virtual Private Server (VPS) Back in “the day” you would have to...

How To Enable HTTP/2 On Your cPanel VPS

How To Enable HTTP/2 On Your cPanel VPS Enable HTTP/2 Using Easy Apache 4 Those using...