1

I have a question about usermod this command. I type as below:

sudo usermod -G adm -a pi
It is a normal way to append group "adm" to "pi" my raspberry. If I want to continue to append a lot of group such dialout, chrom, sudo, audio and others, how can I just type one script command only to make all groups to be? Currently, I append them each by each.

Wrong syntax: sudo user -G adm dialout chrom sudo -a pi

By the way, are there any books for dummies about this topics? I want to learn about shell-script, bash and more elaborate or essential commands about raspbian. Thanks

2

You can check the syntax for a command by reading the man page (Linux's built in help files):

man useradd

The relevant section is:

-G, --groups GROUP1[,GROUP2,...[,GROUPN]]] A list of supplementary groups which the user is also a member of. Each group is separated from the next by a comma, with no intervening whitespace. The groups are subject to the same restrictions as the group given with the -g option. The default is for the user to belong only to the initial group.

You need to separate the groups with a comma and remove the whitespace, like this:

sudo usermod -G adm,dialout,chrom,sudo -a pi

As for a book, I started with Linux for Dummies way back in the mid 90's. The Raspberry Pi Foundation also publishes several ebooks, including Conquer the Command Line - which is free.

I can also recommend the Intro to Linux course from EdX

  • 2
    I hope that Conquer the Command Line is illustrated featuring Coco, the Cantankerous Canary who talks like a parrot: "Use commas and beware of whitespace, squawk!". Otherwise they need a second addition. – goldilocks Aug 18 '16 at 12:25
  • Thanks all. I fixed and rebuilt the group for my account. – jefferyear Aug 25 '16 at 7:05

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.