Wie kann ich problemlos zwischen Dvorak- und Qwerty-Tastaturlayouts von einer Linux-Systemkonsole aus wechseln?

2231
Steve HHH

Ich wechsle zwischen Dvorak- und Qwerty-Tastaturlayouts und finde mich häufig mit nicht übereinstimmenden Layouts auf meinem Host-Betriebssystem und einer virtuellen Linux-Maschine wieder.

Wie kann ich das Layout leicht wechseln, wenn ich ein falsches Layout eingestellt habe? Ich spreche hier von der reinen Befehlszeilen-Systemkonsole, nicht von einem Terminalfenster in einer GUI.

2
Dies kann auch hilfreich sein http://superuser.com/questions/598405/how-do-i-switch-to-dvorak-across-multiple-oss#comment741771_598405 William vor 10 Jahren 0

1 Antwort auf die Frage

4
Steve HHH

I found the solution to be to create the following aliases in my .bashrc file:

alias asdf="sudo loadkeys dvorak" alias aoeu="sudo loadkeys us" 

Now, when I find myself with the wrong layout, I type the same four keys on the home row to switch layouts.

The only issue I had with this was that it could be difficult to enter a password for the sudo command when the wrong layout is enabled. There are two solutions to this problem, but they may be a security issue in some environments:

  1. Use a strong-ish password comprised only of numbers, symbols, and the letters M and A (they're the same for both Dvorak and Qwerty).

  2. Set the suid bit on /usr/bin/loadkeys so it automatically runs as root (and you don't need to run it with sudo). I used the command sudo chmod u+s /usr/bin/loadkeys. Note: I needed to install the console-data package beforehand.

Edit: added excellent suid suggestion from ssmy.

Nizza Passwort Problemumgehung. Könnte ein Sicherheitsproblem sein, aber vielleicht können loadkeys auf suid gesetzt werden? ssmy vor 11 Jahren 1
Ja, mein Passwort-Vorschlag würde in einer Produktionsumgebung nicht den Senf abschneiden. Auf meinen persönlichen Systemen deaktiviere ich immer den SSH-Kennwortzugriff, um die RSA-Schlüsselauthentifizierung zu erzwingen, und gebe nur ein Kennwort entweder für "sudo" oder auf der Systemkonsole ein. Steve HHH vor 11 Jahren 0