USB/Serial, how to add all Users to "dialout" group!

Hello!

I’m trying to add all users on system to group “dialout”, I need this to an application works because the app uses the USB/SERIAL and the users need permission to read/write on this devices.
So to not need run the app using “root” I need to add all users to “dialout” group…
How can I do that with shell script?

I have one who works very well on Debian/Ubuntu, as you can see:


#!/bin/bash
 awk -F: '$3 > 999 {print $1}' /etc/passwd | xargs -I USERNAME sudo usermod -a -G dialout USERNAM

Any help is valid!
Thanks all!

The same script should work on openSUSE as /etc/passwd is the same and
user id’s start with 1000 which is also the same and also dialout is the
same group here as in Debian.


PC: oS 12.2 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.8.5 | GTX 650 Ti
ThinkPad E320: oS 12.2 x86_64 | i3@2.30GHz | 8GB | KDE 4.9.3 | HD 3000
eCAFE 800: oS 11.4 i586 | AMD Geode LX 800@500MHz | 512MB | lamp server

Well I made a Change, because the error that is showing:


#!/bin/bash

awk -F: '$3 > 999 {print $1}' /etc/passwd | xargs -I USERNAME sudo usermod -A -G dialout USERNAME

“-A” not “-a”.

But now I got this error:

linux-a63j:/home/dvl/Documents/inove-bevsat-1.0.0 # ./permission.sh
usermod: Too many arguments.
Try usermod --help' or usermod --usage’ for more information.
usermod: Too many arguments.
Try usermod --help' or usermod --usage’ for more information.

Revolved:


#!/bin/bash

awk -F: '$3 > 999 {print $1}' /etc/passwd | xargs -I USERNAME sudo usermod -A dialout USERNAME

Am 20.11.2012 18:16, schrieb dcbasso:
>
> I not sure yet if is working but I remove the parameter -G and not error
> is showing!
>
>
that’s correct, sorry I missed that the usermod differs from debian, so
I have not paid attention to the options you passed to it. The -A option
adds the user to additional groups, that’s fine.
Did you test a user to see if it worked?


PC: oS 12.2 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.8.5 | GTX 650 Ti
ThinkPad E320: oS 12.2 x86_64 | i3@2.30GHz | 8GB | KDE 4.9.3 | HD 3000
eCAFE 800: oS 11.4 i586 | AMD Geode LX 800@500MHz | 512MB | lamp server

On 2012-11-20 18:16, dcbasso wrote:
>
> I not sure yet if is working but I remove the parameter -G and not error
> is showing!

Read the man page…


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” (Minas Tirith))

Yes I test and works fine!
And need to remove the “-G” option!

I Read the --help and them I found the problem…
For example in debian is “-a”, at opensuse is “-A”…
Thanks anyway!

I repeat what is said earllier here. You should of course read the man page of such a tool first (not only, or not all, the --help).
You cannot expect us to check all those opetions for you when you show us a script with such an awk statement. People will naturaly try to check the logics behind the awk statment, but not check if you forgot to read the man pages.

OK!
I just not undestand so much differences between the usage on Debian and OpenSuse…
THis kind of things should user some pattern, it will make easier to developer and for some users too!

Well on UBuntu I install all and configure everything but not works as I needed or I expected!
Lets try with OpenSuse!

dcbasso wrote:
> OK!
> I just not undestand so much differences between the usage on Debian
> and OpenSuse…
> THis kind of things should user some pattern, it will make easier to
> developer and for some users too!

Agreed, absolutely. Unfortunately, user management is one area that
differs quite a lot between distros. package management is another,
probably better known such area.

On package management, if some day appear one that can run on all distros will be nice!
Like, the distros could still using .rpm/.deb but has another one open, secure, multiplatform… That’s only one Idea!

  • I look for something like this and I don’t find nothing like this.

Am 21.11.2012 12:56, schrieb dcbasso:
> I just not undestand so much differences between the usage on Debian
> and OpenSuse…

Simple, they do not use the same versions of all the software, so there
can be differences.


PC: oS 12.2 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.8.5 | GTX 650 Ti
ThinkPad E320: oS 12.2 x86_64 | i3@2.30GHz | 8GB | KDE 4.9.3 | HD 3000
eCAFE 800: oS 11.4 i586 | AMD Geode LX 800@500MHz | 512MB | lamp server