selfprivacy.org/content/en/docs/How To Guides/root_ssh/_index.md

3.3 KiB

title linkTitle weight date description categories
How to get root access via SSH Root access via SSH 1 2023-03-14 If you need to manually perform some tasks, you can get root access via SSH.
How-To Guides

To access your server's root shell you will have to generate your SSH key and add it to your server's authorized keys.

How to generate SSH key

Unix-like systems (PC)

  1. Open the terminal.
  2. Run the following command:
    ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519
    
    You will be asked to enter a passphrase. You can leave it empty, but it is recommended to use a passphrase. If you do not want to use a passphrase, press Enter.
  3. Print the public key to the terminal and copy it:
    cat ~/.ssh/id_ed25519.pub
    
  4. Refer to the next section to add the key to your server.

Windows

  1. Open settings and under "Applications" click on "Manage additional components".
  2. Press "Add Component".
  3. Enter "OpenSSH client" in the search box and install it.
  4. Open the Command Prompt. You can do this by pressing Win+R, typing cmd and pressing Enter.
  5. Run the following command, replacing user_name with your Windows username:
    ssh-keygen -t ed25519 -f C:\Users\user_name\.ssh\id_ed25519.pub
    
    You will be asked to enter a passphrase. You can leave it empty, but it is recommended to use a passphrase. If you do not want to use a passphrase, press Enter.
  6. Print the public key to the terminal and copy it:
    type C:\Users\user_name\.ssh\id_ed25519.pub
    
    Once again, replace user_name with your Windows username.
  7. Refer to the next section to add the key to your server.

Android (Termux)

  1. Install Termux. We recommend installing it from F-Droid.
  2. Open Termux.
  3. Run the following command:
    apt update -y && apt upgrade -y && apt install open-ssh -y &&
    ssh-keygen -t ed25519 -f /data/data/com.termux/files/usr/etc/ssh/ssh_host_ed25519_key
    
    You will be asked to enter a passphrase. You can leave it empty, but it is recommended to use a passphrase. If you do not want to use a passphrase, press Enter.
  4. Print the public key to the terminal and copy it:
    cat /data/data/com.termux/files/usr/etc/ssh/ssh_host_ed25519_key.pub
    
  5. Refer to the next section to add the key to your server.

How to add the key to your server

  1. Open the SelfPrivacy app.
  2. Go to the "More" tab.
  3. Tap on "Superuser SSH keys".
  4. Tap on the "Create SSH key" button.
  5. Paste the public key you copied earlier.
  6. Tap on the "Create SSH key" button.
  7. Open the Jobs list
  8. Tap on the "Start" button.
  9. In a few minutes, you will be able to access your server's root shell via SSH.

{{< imgproc more-superuser Fill "1001x808">}} {{< /imgproc >}}

How to access your server's root shell via SSH

  1. Open the terminal or Command Prompt.
  2. Run the following command, replacing server_ip with your server's domain:
    ssh root@server_domain
    
  3. Enter the passphrase you entered when generating the SSH key, if you used one.

Be careful when using the root shell. If you do not know what you are doing, you can break your server or leak your data. Responsibility for the consequences of your actions lies with you. Respect the privacy of other users.