Accessing NameCrane CPANEL Shared hosting by SSH

For those too dumb to remember how SSH/Keys work

This may also be useful for other shared hosting providers. Be aware that not all of them offer this option by default, even if it appears in CPanel. Check with your hosting provider before continuing.

Now, let's break this command down:

ssh [email protected] -p some_port -i /home/localuser/.ssh/thisprivatekey -vvv

Getting there step by step:

  1. Generate a public & private key pair in the SSH CPanel section.

    • Use a passphrase, don't leave it blank. This passphrase will be asked in the login propmpt.

    • I'd recomment to call your key pair with a particular name, as you'll probably have other keys with names such as "id_rsa" in your ~/.ssh/ folder, and you don't want to overwrite them.

  2. Download them into your ssh folder, in Linux that would be ~/.ssh/. The public key will end in .pub. Give the PRIVATE key a CHMOD of 600. If you're using a GUI, it should have no permisions for others or group, and read/write for your own user.

  3. Find you main CPANEL user under the "User Manager" section. That user name is what would be in "cpaneluser" in the command above.

  4. Now, most hosts will have the default ssh port changed, ask your host about the ssh port.

  5. So, let's say our main user is "iagovar" in out domain "awesomewebsite.com" and our host uses the port "5000", with our key pairs named "awesomekey" and "awesomekey.pub", with "awesomepassphrase" as passphrase.

    ssh [email protected] -p 5000 - i /home/iagovar/.ssh/awesomekey -vvv

    If something fails, the -vvv command should explain you what's going on, so you can debug further.

  6. The loging prompt should be asking for your passphrase (awesomepassphrase), so type it, press enter, and viola! you're in!

And what about VSCode?

If you want to connect directly with VSCode, just provide the same command without the -vvv and you're done. VSCode will ask you the passphrase every time you need it.

Remember you're in a shared hosting, don't expect this to be powerful and don't be surprised if you're suspended if you abuse it. Shared hosting are not meant to make any heavy lifting.