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

Expand your DevOps skills!

Join hundreds of Rails developers and operators on my email list and get my ebook Build Your Own Rails Server as a free welcome gift.

No spam — guaranteed. You can leave at any time.