3 minute read
How to get root access via SSH
If you need to manually perform some tasks, you can get root access via SSH.
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
If you are a Unix-like system user
- Open the terminal.
- Run the following command:
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.
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519
- Print the public key to the terminal and copy it:
cat ~/.ssh/id_ed25519.pub
- Refer to the next section to add the key to your server.
If you are a Windows user
- Open settings and under “Applications” click on “Manage additional components”.
- Press “Add Component”.
- Enter “OpenSSH client” in the search box and install it.
- Open the Command Prompt. You can do this by pressing Win+R, typing
cmd
and pressing Enter. - Run the following command, replacing
user_name
with your Windows username: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.ssh-keygen -t ed25519 -f C:\Users\user_name\.ssh\id_ed25519
- Print the public key to the terminal and copy it:
Once again, replace
type C:\Users\user_name\.ssh\id_ed25519.pub
user_name
with your Windows username. - Refer to the next section to add the key to your server.
If you are a Android (Termux) user
- Install Termux. We recommend installing it from F-Droid.
- Open Termux.
- Run the following command:
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.
apt update -y && apt upgrade -y && apt install openssh -y && ssh-keygen -t ed25519 -f /data/data/com.termux/files/usr/etc/ssh/ssh_host_ed25519_key
- Print the public key to the terminal and copy it:
cat /data/data/com.termux/files/usr/etc/ssh/ssh_host_ed25519_key.pub
- Refer to the next section to add the key to your server.
How to add the key to your server
- Open the SelfPrivacy app.
- Go to the “More” tab.
- Tap on “Superuser SSH keys”.
- Tap on the “Create SSH key” button.
- Paste the public key you copied earlier.
- Tap on the “Create SSH key” button.
- Open the Jobs list
- Tap on the “Start” button.
- In a few minutes, you will be able to access your server’s root shell via SSH.
How to access your server’s root shell via SSH
- Open the terminal or Command Prompt.
- Run the following command, replacing
server_domain
with your server’s domain:ssh root@server_domain
- 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.