Logging In as Root via SSH

From PrgmrWiki
Revision as of 06:10, 16 September 2020 by Paul (talk | contribs) (Created page with "__FORCETOC__ = Introduction = This page is for users who wish to control their service by the command line, as the root user. If you wish to use the serial console, see Ma...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Introduction

This page is for users who wish to control their service by the command line, as the root user. If you wish to use the serial console, see here.

Note that root access is both powerful and potentially risky. Be sure that you know what you're doing as root, since a mistake in a command can have serious consequences for your data or your operating system.

Setting up OpenSSH and Making an SSH Key

OpenSSH is a common open-source SSH server. If you don't have an SSH key already then see Making an ssh key for more information.

Setting the SSH Key on your VPS

For this, you will need to log in to your account through the prgmr.com website. You will also need to locate your SSH public key and where it is stored on your computer.

  • On Windows the default location is C:\Users\[username]\.ssh
  • On Linux and MacOS the default is ~/.ssh/

The private key will be named [keyname], as set when you generated the key pair. The public key will be be named [keyname].pub. So for example "id_rsa" and "id_rsa.pub".

  1. Open your public SSH key in a text editor.
  2. In your browser, navigate to www.prgmr.com
  3. In the upper right corner of the page, click "Log In," and enter your credentials.
  4. In the block labeled "Services," find the name of the VPS that you want to work with.
  5. Click the "Manage" link at the far right end of the row to open your account page.
  6. In your account page, click "SSH Keys" on the left.
  7. In the SSH keys text box, copy paste your SSH public key.
  8. Log out of your account and close the page.

NOTE: This procedure can only add a new SSH key to your VPS. It does not remove or overwrite the old one, if there is any.

Logging in as root

  1. Open a command prompt for your system.
    • For Linux, open a terminal emulator by your favorite method, according to your distribution.
    • For Windows, press the Windows key and type cmd in the search box. Select "Command Prompt" from the search results.
    • For MacOS, open the Finder from the Dock. Select "Other," then select "Terminal."
  2. Navigate to the folder that you used to store your SSH key. See the section above.
  3. Log in with the following commands and your SSH pass phrase. [name] is the label of your VPS. Your output may differ slightly from this.

ssh -i id_ed25519 root@[name].xen.prgmr.com
The authenticity of host '[name].xen.prgmr.com ([IP Address])' can't be established.
ECDSA key fingerprint is SHA256:ojGcHtsis7eyo1P0ouNhnBtHS8ds5KQadv6dExQpnWk.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[name].xen.prgmr.com' (ECDSA) to the list of known hosts.
Enter passphrase for key 'id_ed25519':
Welcome to Ubuntu 20.04 LTS (GNU/Linux 5.4.0-26-generic x86_64)

* Documentation:  https://help.ubuntu.com
* Management:     https://landscape.canonical.com
* Support:        https://ubuntu.com/advantage

Last login: Sun Sep 13 22:40:27 2020 from 108.204.4.7
root@[name]:~#

When you are ready to log out of your machine, enter exit at any command prompt.