Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just upgraded from 10.04 LTS to 12.04 LTS on my server (DELL Intel XEON). By SSH login from my mac (OS X Lion) everything is fine (no issues with command lines) but when I open a window through X11, the keyboard layout is now completely messed up. As an owner of a french mac keyboard, I got used to such issues and could deal by guessing the "QUERTY" keys, but this time it's worse.

To fix it, I tried:


sudo dpkg-reconfigure keyboard-configuration

=> no effect


sudo gnome-control-center

then change the keyboard settings, however adding a couple of keyboard layouts did not change anything.

I feel there is something to do with the X11 forwarding. Any hints?


share|improve this question
I eventually fixed my problem, what I did exactly is: 1/ check the "Follow system keyboard layout" and "Enable key equivalent under X11" items in X11 preferences 2/ quit X11. Once launching a new window through X11, the keyboard layout was properly handled. – LostInTranslation Sep 18 '12 at 22:49
can you add that as an answer? – Mateo Oct 1 '12 at 22:50
Sure, if that's the way to do. – LostInTranslation Oct 2 '12 at 20:54
up vote 2 down vote accepted

I eventually fixed my problem, what I did exactly is:

  1. in X11 preferences, I checked the "Follow system keyboard layout" and "Enable key equivalent under X11" items ;
  2. quit X11. Once X11 reopened, the keyboard layout was properly handled.
share|improve this answer

In my case, running Yosemite and the latest version of xquartz, going through ssh -X to CentOS 6.5 in VMWare Fusion, I could not resolve that problem with switching layouts. US and Russian layouts, in my case. When I started, for example, gnome-terminal, I just couldn't switch to my RU language, using any key combinations. So, after half a day of experimenting (I am not really a Linux geek, just kinda "half-of-a-power" user), I found a solution.

Your mac ~/.profile should look like this:

export LC_COLLATE=en_US.UTF-8
export LC_ALL=ru_RU.UTF-8

If you use another language, change LC_ALL= for your language in your MacOs.

Then you need to add the following line at the end of your ~/.bash_profile on your ssh-connected machine (in my case - CentOS 6.5)

setxkbmap -rules evdev -model pc104 -layout us,ru

This goes correctly, especially for the Russian language. But I am sure your OS must have another collection of layouts. And, at the end - ensure, than you enabled "Follow system keyboard layout" in X11->Preferences->Input tab.

After these manipulations, forwarded through ssh-X11, the GUI of your application will be able to switch layouts, using your usual MacOS shortcut. In my case, Command+Space. Don't forget to restart X11.

Maybe this will help someone ;-)

P.S.: in this example, I worked only with the Russian layout and keymap, so, again, change parameters for your own!

share|improve this answer
Your English is pretty decent, would go without editing, but you should not use slang. – Luís de Sousa Nov 29 '14 at 18:34
thank you! i've just wanted to make it understandable as possible :-) and im new here, don't know your rules, so please, sorry – DioXine Nov 29 '14 at 18:37
Detailed and understandable answers is what AskUbuntu needs. Keep them coming. – Luís de Sousa Nov 29 '14 at 18:39
thanx, for correcting me in that CODE places, but i hope it is not bad if i was exampling another os than ubuntu? :-) – DioXine Nov 29 '14 at 18:43
Regarding the scope of the question I think it is fine. – Luís de Sousa Nov 29 '14 at 19:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.