The problem is very similar to Raspberry Pi keys are switched? but different. I just did a clean install of Raspberry Pi OS and have two users: UserA is the user I created initially and has permissions to use sudo; UserB was created via "sudo adduser userb" and does not have permissions to sudo. With either user, when I go into Raspberry Pi Configuration > Localization it shows:

  • Locale

    • Language: en (English)
    • Country: US (United States)
    • Character Set: UTF-8
  • Keyboard

    • Model: Generic 105-key PC
    • Layout: English (US)
    • Variant: English (US)

For both users, the @ key typed a " and vice versa. The actual physical keyboard is a typical US-layout keyboard (Dell).

While logged in as UserA, I fiddled with the locale and keyboard settings - change them to something else then change them back - and now typing an @ gives me an @. However when I log in as UserB, the keys are still switched. Since UserB does not have sudo permissions, when I try to make changes in Raspberry Pi Configuration, it prompts for a password and does not make the changes. Given that it should be updating /etc/defaults/locale and /etc/defaults/keyboard, that should affect all users, but evidently there is something else going on. After getting UserA to work correctly, as an experiment I tried creating a third user per "sudo adduser userc" and that new user had the switched keys just like UserB.

The contents of /etc/default/locale:


The contents of /etc/default/keyboard:



Are there additional per-user settings in one of the dot files causing UserA to work correctly or UserB to work incorrectly? How do I make UserB's keyboard behave as desired and as the global settings seem to indicate it should?

  • This is unclear. All users should have the same locale & keyboard (unless deliberately switched).
    – Milliways
    Commented Apr 14 at 0:26
  • @Milliways Given the settings are stored under /etc/defaults I too would have thought all users should have the same settings. And Raspberry Pi Configuration is showing the same values for all users, but all users are not getting the same behavior. You mentioned "unless deliberately switched" - where would a per-user override be stored?
    – user221592
    Commented Apr 14 at 12:44
  • This is a mystery to me too. It probably occurred because you changed after creating a new user. I know it can be set in some of the login files. localectl claims to set default for all users (but I have never used it). It is possible to have multiple locales and you would be able to see them but I am unaware of a method of switching between them although this is common on other OS.
    – Milliways
    Commented Apr 14 at 13:06

1 Answer 1


After adding a user you can copy groups from user pi:-

for GROUP in $(groups pi | sed 's/.*:\spi//'); do sudo adduser username $GROUP; done

You can give the user passwordless sudo by creating a nopasswd file.
The easiest way to do this is copy existing.

sudo cp /etc/sudoers.d/010_pi-nopasswd /etc/sudoers.d/010_xxx-nopasswd

then edit replacing pi with username.
There are other ways, involving editing files but this is error prone and risks locking you out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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