VPS bootstrap: stop accepting the client's locale over SSH #2

Merged
smadzar merged 1 commits from fix/bootstrap-no-client-locale into main 2026-10-26 14:46:21 +01:00
Owner

Problem

After bootstrap, every login from a PC with a different locale prints a stack of warnings:

-bash: warning: setlocale: LC_CTYPE: cannot change locale (en_GB.UTF-8): No such file or directory

Debian's sshd_config has AcceptEnv LANG LC_*, and the client's ssh_config sends LANG/LC_*. The server only generates en_US.UTF-8.

Fix

During hardening, comment out AcceptEnv so the server uses its own en_US.UTF-8. The change runs before the existing sshd -t check and reload.

Test

Ran on debian:trixie with openssh-server: line 114 AcceptEnv LANG LC_* COLORTERM NO_COLOR gets commented out, sshd -t passes, and sshd -T shows no active acceptenv.

Already bootstrapped servers

As root:

sed -i 's/^[[:space:]]*AcceptEnv[[:space:]]/#&/' /etc/ssh/sshd_config && systemctl reload ssh
## Problem After bootstrap, every login from a PC with a different locale prints a stack of warnings: ``` -bash: warning: setlocale: LC_CTYPE: cannot change locale (en_GB.UTF-8): No such file or directory ``` Debian's `sshd_config` has `AcceptEnv LANG LC_*`, and the client's `ssh_config` sends `LANG`/`LC_*`. The server only generates `en_US.UTF-8`. ## Fix During hardening, comment out `AcceptEnv` so the server uses its own `en_US.UTF-8`. The change runs before the existing `sshd -t` check and reload. ## Test Ran on `debian:trixie` with `openssh-server`: line 114 `AcceptEnv LANG LC_* COLORTERM NO_COLOR` gets commented out, `sshd -t` passes, and `sshd -T` shows no active `acceptenv`. ## Already bootstrapped servers As root: ``` sed -i 's/^[[:space:]]*AcceptEnv[[:space:]]/#&/' /etc/ssh/sshd_config && systemctl reload ssh ```
smadzar added 1 commit 2026-10-26 14:36:51 +01:00
Debian's sshd_config has AcceptEnv LANG LC_*, so a PC with e.g.
en_GB.UTF-8 makes bash print setlocale warnings on every login because
only en_US.UTF-8 is generated on the server. Comment out AcceptEnv during
hardening so the server keeps its own locale.
smadzar merged commit 774dd8ae40 into main 2026-10-26 14:46:21 +01:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: swissdatabase/rubix-deploy#2