SSH quick setup
/etc/ssh/sshd_config.d/ by hand rather than trusting a single command.linxira-config ssh bundles “install openssh, enable sshd, open the port, manage keys” behind one entry point, but each command has different privilege requirements.
Which commands need sudo
| Command | sudo required | Why |
|---|---|---|
linxira-config ssh status | No | Read-only query |
linxira-config ssh key … | No | Writes only your ~/.ssh |
linxira-config ssh authorized … | No | Writes only your ~/.ssh/authorized_keys |
linxira-config ssh on / off / port | Yes | Edits /etc/ssh/sshd_config.d/ and controls sshd |
linxira-config security ufw … | Yes | Changes firewall rules |
linxira-config net diag | No | Read-only diagnostics |
linxira-config never elevates itself: root-only subcommands fail under a normal user and tell you to use sudo.
Enable and disable
sudo linxira-config ssh on
linxira-config ssh status
sudo linxira-config ssh off
on installs openssh, writes 10-linxira.conf with PasswordAuthentication yes on first enable, starts sshd, and opens the current port when UFW is active. Re-running on on a system already switched to key-only does not reopen password login.
Change the port
sudo linxira-config ssh port 2222
linxira-config ssh status
sudo linxira-config security ufw allow 2222
You must open the new port in the firewall or connections will be dropped; skip that step when UFW is not enabled. Test locally with ssh user@127.0.0.1 -p 2222 before dropping your existing session.
Keys
These run as the current user and need no sudo. Private keys land in ~/.ssh/ with permissions handled for you.
linxira-config ssh key generate work
linxira-config ssh key list
linxira-config ssh key show work
linxira-config ssh key fingerprint work
linxira-config ssh key remove work --yes
Authorize a public key
linxira-config ssh authorized list
linxira-config ssh authorized add "ssh-ed25519 AAAA... user@host"
linxira-config ssh authorized remove SHA256:xxxx --yes
authorized add accepts exactly one plain public-key string (not a file path) and rejects entries carrying options such as command= or environment=. That is deliberate. Run it once per key.
Root and password safety
The default is PermitRootLogin prohibit-password: root may log in with keys only, never with a password. Do not change it to yes unless you fully understand the consequences.
Do daily work as a normal user with sudo, not as root. Check the effective configuration (read-only, but reading system config needs sudo):
sudo sshd -T | grep -E '^(port|permitrootlogin|passwordauthentication)'
To disable password logins entirely, first add your key to authorized_keys and prove key-only login works from another terminal, then run on the server:
sudo linxira-config ssh harden
harden requires at least one usable authorized_keys entry for the invoking user, rewrites 10-linxira.conf with PasswordAuthentication no and KbdInteractiveAuthentication no, validates with sshd -t, then reloads sshd. It refuses without a usable key; add --yes for non-interactive use.
To allow passwords again: sudo linxira-config ssh password on --yes. Do not use 99-linxira-hardening.conf: sshd_config reads drop-ins first and the first value wins, so 10-linxira.conf's yes silently overrides a later no.
Keep your current session open, verify a new connection from another terminal, and only then log out.
Account password strength still matters: sudo, local login, and any SSH path where password auth is still on depend on it. Optional hardening: sudo pacman -S fail2ban and enable fail2ban.service to cut down brute-force attempts.
Connect from another machine
ssh user@192.168.1.100 -p 22
The Connect: line from ssh status gives you the address and port directly.
When it will not connect
linxira-config ssh status— is the service running, and on which port?linxira-config security ufw status— is the port allowed?linxira-config net diag— is the local network stack healthy?sudo sshd -T | grep -E '^(port|listenaddress)'— what is sshd actually bound to?
Security boundaries
ssh onstarts the system-wide sshd and applies to every account- Before exposing to the internet, switch to key-only auth and consider a non-default port or a Tailscale / ZeroTier mesh
- RDP / VNC are not available yet (xrdp is not in the signed repositories); use SSH + X11 forwarding or another approach
Related
- Full remote-access walkthrough: Remote access
- Firewall and security: linxira-config recipes