shorten lines

der.hans PLUGd at LuftHans.com
Mon Mar 16 15:00:01 MST 2015


Am 16. Mär, 2015 schwätzte Michael Havens so:

moin moin Mike,

useradd has an option for adding multiple groups, but you probably need to
specify to make a home directory and bash for the default shell.

sudo useradd -m -s /bin/bash -Gaudio,video,input,dialout,plugdev,tty pi

Looks like adduser might be able to do it in one go if you use
--add_extra_groups.

Or, you can add the user, then use usermod to add the extra groups. This
probably works best for you based on what you were doing.

sudo adduser pi
sudo usermod -a -Gaudio,video,input,dialout,plugdev,tty pi

In all cases, check syntax as I didn't verify the command lines I wrote up
work as is :).

ciao,

der.hans

> I wrote something and was wondering if I could shorten it. I wrote:
>
> sudo adduser pi audio
> sudo adduser pi video
> sudo adduser pi input
> sudo adduser pi dialout
> sudo adduser pi plugdev
> sudo adduser pi tty
>
> And was thinking I could shorten it to:
>
> sudo adduser pi{ audio video input dialout plugdev tty}
>
> Would that work? If not how should I do it?
> :-)~MIKE~(-:
>

-- 
#  http://www.LuftHans.com/        http://www.PhxLinux.org/
#  Whenever I hear anyone arguing for slavery, I feel a strong impulse to
#  see it tried on him personally. -- Abraham Lincoln


More information about the PLUG-discuss mailing list