# Signing In

---

# Signing In

_Peios / Signing In_

> Choose a browser, console, or SSH route and find the account settings for it.

Use a sign-in route enabled by the machine's image and configuration. On an
installed image with setup enabled, complete [first-boot
setup](/peios/first-boot/completing-setup.md) first. A custom image needs a
[first-account provisioning
route](/peios/using-peios/local-accounts/creating-an-account.md#the-first-account).

## Choose a client

| Connection | Guide | Check before entering credentials |
|---|---|---|
| Browser desktop | [Signing in from a Browser](/peios/signing-in/open-the-desktop.md) | Verify the machine's certificate fingerprint through a trusted route |
| Local console | [Using a Console](/peios/signing-in/using-a-console.md) | Use the managed console on the intended machine |
| Remote terminal | [Signing in with SSH](/peios/signing-in/signing-in-over-ssh.md) | Verify the SSH host fingerprint |

Switching virtual consoles does not lock or end the session left behind.
Rejoining a browser desktop can return to its existing session rather than
create a new one.

## Change your own account

Use [My Settings](/peios/using-peios/local-accounts/my-settings.md) for your display name,
password, and SSH keys, or [`passwd`](/peios/using-peios/local-accounts/passwd.md)
from a terminal. Self-service credential changes require the proof accepted
by the principal source; a session token alone does not replace that proof.

Changing another account is an administrative operation. Start with
[Local Accounts](/peios/using-peios/local-accounts/overview.md) or [Principals
Manager](/peios/using-peios/local-accounts/principals-manager.md).

A stored password and credential policy are separate. Setting a password does
not stop credential-free sign-in until the account's policy requires it.
Follow [Managing Credentials](/peios/using-peios/local-accounts/managing-credentials.md),
then verify a fresh sign-in before closing the working session.

## Recover from a refusal

Follow [Diagnosing Authentication](/peios/using-peios/authentication/diagnosing.md)
and preserve a working administrator route. Do not delete the local store to
clear an error: it holds account identities, and an unreadable store is not an
unprovisioned machine.

For the model behind the prompt, read [Authentication
Conversations](/peios/developing-for-peios/authentication-client/conversations.md) and [Sessions and
Account Changes](/peios/using-peios/local-accounts/sessions-and-account-changes.md).

---

# Signing in from a Browser

_Peios / Signing In_

> Open a GXWI desktop, verify its identity, and sign in to a machine account.

GXWI displays the Peios desktop in a browser. Applications run on the
Peios machine, using the authority of the account that signs in.

## Before you start

You need the machine's address, its configured HTTPS port, and an account
on that machine. The default port is `7780`. A machine that listens only
on the built-in address `127.0.0.1` needs a reachable listen address and
network policy before another device can connect.

You also need a trusted way to read the machine's certificate fingerprint,
such as its local console. Do not enter credentials before verifying an
unfamiliar certificate.

## Open the desktop

1. Open `https://<machine-address>:7780` in your browser. Replace
   `<machine-address>` with the machine's address or name. Use its configured
   port if it differs from `7780`.
2. If the browser warns about the certificate, follow
   [Verifying the Machine's Certificate](/peios/signing-in/the-certificate.md).
3. Enter your account name and complete the requested authentication.
4. Check that your desktop appears. Open an application to confirm that the
   session is ready.

An HTTP request redirects to HTTPS. GXWI does not serve a desktop over an
unencrypted connection.

If an installer or setup program appears, the machine is using an
[overlay](/peios/using-peios/desktop-service/overlays.md). Follow that program's instructions.
Normal sign-in and existing desktops remain inaccessible while the overlay
is configured.

## Leave and return

Closing a browser tab does not request the end of the desktop session.
Sign in again to reconnect to a running session. Unsaved application state
survives only while the application and its session remain running.

Use the desktop's sign-out action to end the session. Do not treat closing
a tab on a shared device as signing out of the machine.

---

# Verifying the Machine's Certificate

_Peios / Signing In_

> Compare a GXWI certificate with a trusted fingerprint before entering credentials.

GXWI creates a certificate for the machine rather than relying on a public
certificate authority. Verify its fingerprint before trusting an unfamiliar
certificate or entering credentials.

## Before you start

Use the machine's trusted local console or another independently verified
channel. A page delivered through the connection being checked cannot
establish that connection's identity.

## Compare the fingerprints

1. At the trusted console, read `/var/state/gxwi/certificate.sha256`.
   The file contains the certificate's SHA-256 fingerprint and is public.
2. In the browser's certificate details, find the SHA-256 fingerprint of the
   certificate presented by the machine.
3. Compare all 32 byte pairs. Spaces or colons between pairs do not affect
   the value. If the fingerprints differ, do not sign in.
4. If they match, check the certificate's name and validity period before
   accepting it or importing it into your browser's trust store.

A matching fingerprint ties the presented certificate to the certificate
read through the trusted channel. It does not establish that a different
hostname is valid for that certificate.

## Trust the verified certificate

The public certificate is `/var/state/gxwi/certificate.pem`. Transfer it
through a trusted channel and import it using your browser's or operating
system's certificate controls. Import only the certificate, never
`key.pem`.

The generated certificate includes the hostname at creation, `localhost`,
`127.0.0.1`, and `::1`. Other network addresses are not included
automatically. Inspect the certificate actually presented; importing it
does not fix a name mismatch or expiry.

Browser trust affects more than the warning page. The
[waiting page](/peios/using-peios/desktop-service/reconnection.md) uses a service worker,
which requires a browser environment that permits it. A certificate
exception does not guarantee that the browser permits service workers.

## Check again after a change

[Certificate renewal](/peios/using-peios/desktop-service/certificate-lifecycle.md)
changes the fingerprint even when the private key stays the same. Verify
the replacement through the trusted channel before importing it.

## Installation and first boot

Installation, a restored machine image, or loss of persistent certificate
state can also change the presented certificate. Installation completing
does not prove that the certificate was retained. Verify the installed
machine's fingerprint before entering credentials.

---

# Signing in at a Console

_Peios / Signing In_

> Sign in through the terminal client and understand its fallback behavior.

The `login(1)` client collects credentials at a terminal, receives a token
from `authd`, installs it, and replaces itself with your shell. Use the
managed console provided by the system; running `login` does not grant an
ordinary process permission to originate a logon.

## Sign in

Follow these steps:

1. At the console's account prompt, enter your account name.
2. Answer the credential prompts. Password input is not echoed.
3. Check that the intended account's shell starts in its home directory.

The terminal client supports password prompts. Accounts restricted to SSH
public-key authentication need a client that supports that exchange.

Credential input uses buffers that erase their contents when released. This
also applies to partial input when reading a credential from a pipe fails.
The input source and any copies made by the caller remain their owners'
responsibility.

If the account's home is unavailable, `login` reports the failure and starts
in `/`. A successful sign-in does not prove that the recorded home or shell is
usable. A shell that cannot be executed causes the client to fail.

## Named attempts and automatic sign-in

A managed console can select an account before presenting a prompt:

- **A named account:** a refusal ends that attempt.
- **`--try`:** a nonfatal refusal falls back to an account prompt.
- **`--try-no-password`:** an attempt that offers no credential collection;
  an account needing credentials falls back to the ordinary prompt.

A fallback is explained if the attempt already displayed a credential prompt
or message. If nothing was displayed, the client moves directly to the
account prompt. An unavailable authority or a caller that cannot originate
the logon ends the attempt: asking for another account would not repair that
failure.

The preliminary account lookup uses read and write timeouts. If the client
cannot set those timeouts, it treats the lookup as unavailable and continues
without claiming that the account exists or is absent.

These options do not bypass authentication. `authd` and the principal source
still decide whether to grant a token. The `-f` authentication bypass is not
supported.

Credential-free automatic sign-in requires an account whose credential policy
permits it. Its use is not restricted to one console by the account policy
alone. Keep such accounts limited to deliberate development or live image use.

## Managed console services

The shipped console seed defines the primary `login-console` service and
additional prompts on `tty1`, `tty2`, and `tty3` when those devices exist.
Images choose whether to apply that seed. The primary console's precedence
prevents a second prompt taking the same terminal; first-boot setup takes
precedence over ordinary prompts.

Peinit fixes `/dev/console` to its selected terminal when loading the service
configuration. Switching virtual consoles does not move that service or lock
the session left behind. Its [terminal ownership and exit
rules](/peios/using-peios/services-and-jobs/execution-environment.md#system-console-aliases-and-logout)
control cleanup and the next prompt.

System Settings changes the selected account through the console service's
arguments. The next service start uses the changed arguments; it does not
replace an already running session or change the account's credential policy.

## Session preferences

Without `-p`, the client constructs the shell environment from the granted
profile. It sets the account and home variables, sets `PATH` to `/bin`, and
preserves or chooses the terminal type.

Locale preferences come from the machine and the granted account's user
registry settings. The client removes inherited `LC_ALL` and `LANGUAGE` and
refreshes locale preferences even with `-p`. Locale changes apply to later
sessions, not programs that already inherited an environment.

The managed `--console` mode also prepares terminal input and waits for
first-boot setup to finish before accepting credentials. Browser-address
information is optional; its absence does not prevent terminal sign-in.

The browser banner is printed once per invocation. It contains configured
addresses and the machine's certificate fingerprint, not a health check of
the browser service. A reachable address still needs the certificate check
described in [Signing in from a
Browser](/peios/signing-in/open-the-desktop.md).

For all flags and environment details, read `login(1)`. For failures, use
[Diagnosing Authentication](/peios/using-peios/authentication/diagnosing.md).

---

# 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. |
