Problem using SSH to connect from Big Sur to Linux boxes

After upgrading to Big Sur on my MacBook there are problems connecting to a Linux box it the Linux box has a default shell other than bash. If it has zsh or fish for example you get multiple errors complaining about the LOCALE variables not being set properly. If the box is using bash you can connect and then switch to another shell with no problem.

This just started when I upgraded from Catalina to Big Sur. No problems if I SSH from my Mac Mini which is still running Mojave, so it definitely appears to be due to some change in Big Sur.

Has anyone else seen this? My web searches haven’t turned up anything.

go to Terminal.app on the Mac and enter this line:

fgrep 'SendEnv LANG LC_' /etc/ssh/ssh_config

and see if you get

SendEnv LANG LC_*

or something else.

Thanks for the suggestion, but that doesn’t seem to be what’s going on in my case.
I see SendEnv LANG LC_* on both Bug Sur and Mojave

I found a solution, or at least a workaround on this here.

Briefly, you need to edit /etc/ssh/sshd_config on the server, that is on the target Linux system, and change this line

AcceptEnv LANG LC_*

to

AcceptEnv no

Then restart the SSH daemon

sudo systemctl restart sshd

This prevents the server from accepting any of the enviroment variables passed from the client. Apparently something changed with Big Sur in the way it passes the variables to the server.

I’ve tested this with both the Big Sur and Mojave clients and it seems to work in both cases. As for the Linux boxes, they were running Ubuntu 20.04 LTS, and Siduction (based on Debian Sid).

2 Likes

Interesting. I don’t do this a lot, but will definitely file it away in the memory banks.

You can also solve this client side in Big Sur, by editing the /etc/ssh/ssh_config file and removing or commenting out the line "SendEnv LANG LC_" so the last part reads:
Host *
# SendEnv LANG LC_

1 Like