Michael Trojanek (relativkreativ) — Bootstrapper and creator of things

This article was published on May 12th 2014 and takes about 1 minute to read.

Use it with caution — it is probably still valid, but it has not been updated for over a year.

How to make your server speak English

When you log in to your server via SSH, you want the commands' output to be in English. Other languages can cause problems, mainly with poorly written scripts which rely on English output when parsing system commands.

If your server outputs error messages and results of system commands in a language other than English, there are two things you can do about it:

1. Set your system-wide locale

As root, edit the file /etc/sysconfig/i18n (on CentOS/RedHat machines) or /etc/default/locale (on Ubuntu/Debian machines) to use English as the default language. Look for the line that starts with LANG … and change it to use the right locale:

LANG="en_US.utf8"

2. Make the server ignore locales sent over SSH

Especially Mac OS X likes to send local environment variables to your server via SSH. If your server accepts these variables, you end up with command output in your own language which is polite, but not what you want. To put an end to it, open the SSH configuration file (/etc/ssh/sshd_config) as root, find the line which reads

AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES

and remove it or comment it out (put a # in front).

Pick up the changes

After making those changes, restart the SSH daemon to make the changes take effect:

/etc/init.d/sshd restart

Get in the loop

Join my email list to get new articles delivered straight to your inbox and discounts on my products.

No spam — guaranteed.

You can unsubscribe at any time.

Got it, thanks a lot!

Please check your emails for the confirmation request I just sent you. Once you clicked the link therein, you will no longer see these signup forms.