Page 1 of 2 12 LastLast
Results 1 to 10 of 14

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

  1. #1

    Default 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:

    Code:
    #!/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!

  2. #2
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,654

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

    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

  3. #3

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

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


    Code:
    #!/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.

  4. #4

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

    Revolved:

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

  5. #5
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,654

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

    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

  6. #6
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

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

    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))

  7. #7

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

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

    Quote Originally Posted by martin_helm View Post
    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

  8. #8

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

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

    Quote Originally Posted by robin_listas View Post
    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))

  9. #9
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,124

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

    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.
    Henk van Velden

  10. #10

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

    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!


    Quote Originally Posted by hcvv View Post
    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.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •