# Signing in with SSH

_Peios / Signing In_

> Connect to Peios over SSH, verify the host key, and manage access without losing your administrator connection.

Use Secure Shell (SSH) to open a remote shell, run commands, or transfer files
with SFTP. The `dev.peios.openssh` package provides the `sshd` service.
SSH Settings and the `ssh-settings` command manage the same server settings.

Every SSH connection uses a `RemoteInteractive` logon, including commands
without a terminal and SFTP transfers. The account must permit that logon
type. See [Granting Access](/peios/using-peios/authentication/granting-access.md).

Passwords require a credential policy of `password` or `either` and a stored
password. SSH keys require an enrolled key and a policy of `key` or `either`.
An account with policy `none` cannot sign in over SSH. The server does not
read `authorized_keys` files. Principal key enrollment belongs to lpsd.

## Connect from another computer

Before you start, establish a trusted administrator connection at the local
console or through a certificate-verified GXWI browser session.

1. Read the network address, server status, port, and host-key fingerprint:

   ```sh
   net status
   ssh-settings
   ssh-settings fingerprint
   ```

   Check that the server is running. Choose an address reachable from the
   other computer. See [The net Command](/peios/using-peios/network-configuration/the-net-command.md).
   A VM's forwarded host port can differ from the server's listening port.

2. From the other computer, connect with the observed port:

   ```sh
   ssh -p <observed-port> <account-name>@<machine-address>
   ```

   Compare the first-connection fingerprint with the trusted reading.
   This is the SSH host key, not GXWI's TLS certificate fingerprint.
   If the fingerprints differ, stop and investigate. Do not accept the
   key or remove a remembered key to suppress a warning.

3. Sign in and verify that a new shell opens. An existing session does not
   prove that a new connection can authenticate.

## Looking

Show the server settings:

```sh
ssh-settings
```

The output reports whether the service runs, its port, whether passwords are
accepted, and the host fingerprint. SYSTEM and Administrators can read the
host key; other users see an explanation instead of its fingerprint.

The server uses these settings:

| Setting | Source | Shipped value |
| --- | --- | --- |
| Start at boot | `Machine\System\Services\sshd` `Disabled` | On where the service seed is installed |
| Listening port | `Machine\Software\OpenSSH` `Port` | 22 |
| Password sign-in | `Machine\Software\OpenSSH` `PasswordAuthentication` | 1 |
| Host identity | `/var/state/sshd/ssh_host_ed25519_key` | Created on first start |

`Port` and `PasswordAuthentication` are `REG_DWORD` values. The startup
helper passes them to sshd on its command line. Setting either option in
`/lcl/etc/ssh/sshd_config` has no effect. That file holds other administrator
overrides, subject to the Peios port's fixed restrictions.

## Turning it on and off

Start the service and configure it to start at boot:

```sh
ssh-settings on
```

Stop the service and keep it from starting at boot:

```sh
ssh-settings off
```

Stopping or restarting the service disconnects every SSH session. Keep a
separate console or GXWI administrator connection available before doing so.

Changing the boot setting requires write access to the service registry key.
Starting or stopping the service also requires peinit's service-control
rights.
Without those rights, the command saves the boot setting and explains that it
cannot change the running service.

## Moving the port

Move the server to port 2222:

```sh
ssh-settings port 2222
```

The command changes the port setting, sshd's port reservation, and its
firewall rule in one registry transaction. If the optional `ssh` firewall rule
is
absent, the command does not create it. A running server then restarts and
disconnects all SSH sessions. Reconnect using the selected port.

A port reserved exclusively for another service is refused. A broader
reservation, such as `tcp:1-1023`, permits a more specific reservation within
its range. See [Port Reservations](/kernel/internals/kacs/network-objects/port-reservations.md)
and [Configuring Profiles](/peios/using-peios/network-configuration/configuring-profiles.md).

## Keys only

Turning off SSH password authentication changes the server's accepted methods.
It does not change account credential policy. Keep an account's policy
`either` if its password must also work through GXWI, which uses password
sign-in. An account with policy `password` cannot sign in over SSH while
SSH password authentication is off.

Before turning off passwords:

1. Enroll a key for each account that needs SSH. Use My Settings where
   permitted, or have an administrator run `lps key add`. Adding a key
   does not change policy; an administrator can select `either` with
   `lps policy`. See [Managing Credentials](/peios/using-peios/local-accounts/managing-credentials.md).
2. Check `lps show` and `lps key list` for the enabled account, enrolled key,
   credential policy, and permitted `remote-interactive` logon type.
3. Make a fresh SSH connection that authenticates with the enrolled key.
   Password fallback does not count as a key test. Stop if this fails.
4. Verify a separate administrator sign-in at the console or through GXWI.
   Keep that connection available. Another SSH session is insufficient:
   restarting sshd disconnects every SSH session.

After verifying both routes, turn off SSH password authentication:

```sh
ssh-settings passwords off
```

Make another fresh key-authenticated connection and verify that its shell
opens. If this fails, use the surviving administrator route to restore
password acceptance:

```sh
ssh-settings passwords on
```

This also restarts sshd and leaves account credential policy unchanged.
The last-administrator guard does not prove that a working sign-in route
exists. Keep the separate route until fresh SSH access works again.

## The host key

Read the host-key fingerprint through a trusted administrator connection:

```sh
ssh-settings fingerprint
```

The service creates its Ed25519 host key on first start, validates an existing
key, and never rotates it automatically. The private key is installation
state, not a package file. Do not share it or copy it between machines.

## On the desktop

Open **SSH Settings** from the launcher. The page shows the service, port,
password setting, and host-key fingerprint. Use **Copy** to copy the
fingerprint. Unavailable operations show the reason.

Starting the server takes effect immediately. Stopping it, moving its port,
or changing password acceptance requires confirmation because it disconnects
SSH sessions. The result states whether the running service changed or the
saved setting applies when the service next starts.

## Supported sessions

The server supports interactive shells, remote commands, terminals, and
internal SFTP. TCP, Unix-socket, agent, X11, and tunnel forwarding are off.
Host-based authentication, keyboard-interactive authentication, certificates,
and external authorized-key providers are not accepted by this port.

The shared PGSS SSH public-key authentication specification defines the
authd, lpsd, and monitor contract. The Peios port accepts plain Ed25519 and
RSA SHA-256/SHA-512 signatures with RSA keys from 3072 through 8192 bits.
The monitor binds authentication to the initial SSH exchange. Principal
policy and account status still determine whether authentication succeeds.

## Exit status

The CLI uses these exit codes:

| Code | Meaning |
| --- | --- |
| 0 | The operation or display succeeded. |
| 1 | The operation failed or was refused. |
| 64 | The command line was invalid. |

Related content:

- [Local Accounts](/peios/using-peios/local-accounts/overview.md)
- [Managing Credentials](/peios/using-peios/local-accounts/managing-credentials.md)
- [Configuring Profiles](/peios/using-peios/network-configuration/configuring-profiles.md)
- [Port Reservations](/kernel/internals/kacs/network-objects/port-reservations.md)
