Vagrantfile. Set locale for ssh agent

My answer: I just add a line to my ansible playbook. But it isn't an answer in terms of only Vagrant

- name: set locale
  lineinfile: dest=/etc/default/locale line="LC_ALL=C"

I had the same problem on OSX (the solution is similar for Linux) when connecting to my Vagrant Ubuntu boxes.

I simply "solved" it by editing /etc/ssh_config (or /etc/ssh/ssh_config on Linux) and commenting the following line:

# SendEnv LANG LC_*

This basically stops ssh from sending the LANG and LC_ALL (all LC_ variables) to the remote host, resulting in using the default on the box. In this case en_US.UTF-8.

Obviously this will cause your remote connections to always use the default locale which may not be what you want.

I believe that you can also set the ssh preferences per host but never did so. I you are interested into that, it might be worth looking.


I propose override host locale in Vagrantfile

Vagrant.configure(2) do |config|

  config.vm.box = "ubuntu/vivid64"

  ENV['LC_ALL']="en_US.UTF-8"

end 

The change is not visible outside Vagrant (host env variables remains unchanged)