You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
4.3 KiB
Markdown

1 year ago
# Authentication
11 months ago
PiKVM OS is based on a regular Linux system, so everything about authorization in this OS is also true for PiKVM.
It comes with the following default passwords:
1 year ago
* **Linux admin** (SSH, console, etc.): user `root`, password `root`.
11 months ago
* **PiKVM Web Interface, [API](api.md), [VNC](vnc.md)...**: user `admin`, password `admin`, no 2FA code.
1 year ago
1 year ago
**These are two separate entities with independent accounts.**
1 year ago
11 months ago
Also there is another special Linux user: `kvmd-webterm`.
11 months ago
It can't be used for login or remote access to PiKVM OS and has the non-privileged rights in the OS.
11 months ago
Password access and `sudo` is disabled for it. It is used only for launching the Web Terminal.
11 months ago
These restrictions are set for security reasons.
11 months ago
-----
## Root access in the Web Terminal
11 months ago
As mentioned above, the Web Terminal runs under user `kvmd-webterm` with disabled `sudo` and password access.
11 months ago
However, most PiKVM administration commands require the `root` access.
11 months ago
To obtain it in the Web Terminal, type `su -` and then enter the `root` user password:
11 months ago
11 months ago
```console
11 months ago
[kvmd-webterm@pikvm ~]$ su -
...
[root@pikvm kvmd-webterm]#
```
11 months ago
??? tip "Disabling the Web Terminal"
11 months ago
Sometimes the actual owner of a PiKVM device and the user who is allowed to use it are different people.
So you may want to disable console access from the Web UI. To do this, use the following:
```
[root@pikvm ~]# rw
[root@pikvm ~]# systemctl disable --now kvmd-webterm
[root@pikvm ~]# ro
```
For your own access to PiKVM OS, you will still have SSH.
11 months ago
-----
1 year ago
## Changing the Linux password
1 year ago
```
11 months ago
[root@pikvm ~]# rw
[root@pikvm ~]# passwd root
[root@pikvm ~]# ro
1 year ago
```
11 months ago
-----
1 year ago
## Changing the KVM password
1 year ago
```
11 months ago
[root@pikvm ~]# rw
[root@pikvm ~]# kvmd-htpasswd set admin
[root@pikvm ~]# ro
1 year ago
```
11 months ago
Please note that `admin` is a name of a default user. It is possible to create several different users
1 year ago
with different passwords to access the Web UI, but keep in mind that they all have the same rights:
```
11 months ago
[root@pikvm ~]# kvmd-htpasswd set <user> # Sets a new user with password
[root@pikvm ~]# kvmd-htpasswd list # Show the list of users
[root@pikvm ~]# kvmd-htpasswd del <user> # Removes/deletes a user
1 year ago
```
11 months ago
-----
1 year ago
## Two-factor authentication
This is a new method of strengthening the protection of PiKVM, available since `KVM >= 3.196`.
It is strongly recommended to enable it if you expose the PiKVM in the big and scary Internet.
!!! warning
11 months ago
Using 2FA eliminates the possibility of using [IPMI](ipmi) and [VNC with vncauth](vnc) (both disabled by default).
It also slightly affects the use of [API](api.md) and regular VNC with user/password, read below.
Please note that 2FA does not concern the Linux OS access for the `root` user, so take care of a strong password
for it for SSH access (or setup the [key access](https://www.digitalocean.com/community/tutorials/how-to-configure-ssh-key-based-authentication-on-a-linux-server)).
??? example "Step by step: Enabling 2FA on PiKVM"
1 year ago
11 months ago
1. Update OS and reboot:
1 year ago
11 months ago
```
[root@pikvm ~]# rw
[root@pikvm ~]# pacman -Syu
[root@pikvm ~]# reboot
```
1 year ago
11 months ago
2. **Make sure that NTP is running otherwise you will not be able to access** (`timedatectl` command).
The timezone doesn't matter.
1 year ago
11 months ago
3. Install the `Google Authenticator` app to your mobile device
([iOS](https://apps.apple.com/us/app/google-authenticator/id388497605),
[Android](https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2)). It will generate one-time access codes.
1 year ago
11 months ago
4. Create a secret for one-time codes on PiKVM:
```
[root@pikvm ~]# rw
[root@pikvm ~]# kvmd-totp init
[root@pikvm ~]# ro
```
1 year ago
11 months ago
5. Run the `Google Authenticator` and scan the QR code.
1 year ago
11 months ago
6. Now, on the PiKVM login page, you will need to add 6 digits to the `2FA code` field.
1 year ago
11 months ago
All Web UI users will be required to enter a one-time password on login.
In other words, **the secret is the same for all users**.
1 year ago
1 year ago
!!! note
11 months ago
With 2FA for API or VNC authentication, you will need to append the one-time code to the password without spaces.
1 year ago
That is, if the password is `foobar` and the code is `123456`, then you need to use `foobar123456` as the password.
1 year ago
11 months ago
To view the current QR code of the secret use command `kvmd-totp show`.
1 year ago
11 months ago
To disable 2FA and remove the secret, use command `kvmd-totp del`.