So I used the old useradd command to create a new user on Raspbian Stretch. I copied the .config directory and other dotfiles from the 'pi' user, and started using the new account. However I can't get some software to work. For instance ALSA shows 'no sound card' for my newly created user whereas it works fine with other users. Why is that so? I'm just curious. I supposed that ALSA would use the global config in /etc and hence would work just fine.

I'm aware that I should have used the adduser command, but being a noob I'm curious as to what are the other things that make programs work, other than the configuration files.


On Debian groups are very important to have access to programs. So as user pi I look what groups he is in by default:

pi@raspberrypi:~ $ groups
pi adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi

You don't show what options you have used with useradd to create the new LOGIN. So for reference I use:

pi@raspberrypi:~ $ sudo adduser myuser

and answered the prompted questions. Then I logged out and logged in as myuser and looked at the groups:

myuser@raspberrypi:~ $ groups

As you can see myuser is only member in group myuser. You should add him at least to the same groups then pi. Because myuser isn't in group sudo yet you have to login as user pi to do it:

pi@raspberrypi:~ $ sudo adduser myuser sudo

With adduser you can do it step by step for each needed group but with useradd you can do it in one step with options --gid and --groups when creating the LOGIN. Using usermod with that options you can also modify the existing account in one step.

  • Thank you for that descriptive answer. Is there anything else that I should know before deleting the 'pi' user? – sixter Jan 6 at 2:14
  • @sixter I wouldn't delete the pi user. Just don't use it. If something doesn't work you have a reference where you can look what are the default settings and how it works. And you can always use it for troubleshooting. On Raspbian you cannot login as root by default. – Ingo Jan 6 at 3:13
  • Makes sense. I was thinking the same. – sixter Jan 7 at 10:12

As you have discovered useradd is not the easiest. It would probably be easier to delete the new user and start again.

Either way you need to set groups for the new user. The following will copy groups from user pi

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

See also https://raspberrypi.stackexchange.com/a/83642/8697

It is NOT a good idea to copy .config - you can change file ownership to new user, but there may be problems with some programs which lock profiles.

  • Programs which lock profiles? Could you please explain? – sixter Jan 7 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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