Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Serial Port configuration in RHEL
Forum Updated to NodeBB v4.3 + New Features

Serial Port configuration in RHEL

Scheduled Pinned Locked Moved Unsolved General and Desktop
40 Posts 6 Posters 13.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS SGaist

    NEVER EVER use root like that. All the more when developing. It's bad practice and doing so you're opening a gaping security hole.

    Add your normal user to the dialout group and be done with it.

    N Offline
    N Offline
    Nimika
    wrote on last edited by
    #22

    @SGaist Can I use serial ports to any user other than root?

    mrjjM 1 Reply Last reply
    0
    • N Nimika

      @SGaist Can I use serial ports to any user other than root?

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #23

      @Nimika
      Hi
      Any user can be granted access to /dev/X devices.
      Often it is done via the dialout group as its already assigned to serial devices such as ttyS0 and
      any user that is member of that group can use it.
      so often
      sudo adduser TheUserName dialout
      and and reboot is all that is needed.
      Adding user to group might have slightly different syntax on RH but concept and rights are 100% the same.:)
      http://websistent.com/fix-serial-port-permission-denied-errors-linux/

      N jsulmJ 2 Replies Last reply
      0
      • mrjjM mrjj

        @Nimika
        Hi
        Any user can be granted access to /dev/X devices.
        Often it is done via the dialout group as its already assigned to serial devices such as ttyS0 and
        any user that is member of that group can use it.
        so often
        sudo adduser TheUserName dialout
        and and reboot is all that is needed.
        Adding user to group might have slightly different syntax on RH but concept and rights are 100% the same.:)
        http://websistent.com/fix-serial-port-permission-denied-errors-linux/

        N Offline
        N Offline
        Nimika
        wrote on last edited by
        #24

        @mrjj Thanks let me try it.

        1 Reply Last reply
        0
        • mrjjM mrjj

          @Nimika
          Hi
          Any user can be granted access to /dev/X devices.
          Often it is done via the dialout group as its already assigned to serial devices such as ttyS0 and
          any user that is member of that group can use it.
          so often
          sudo adduser TheUserName dialout
          and and reboot is all that is needed.
          Adding user to group might have slightly different syntax on RH but concept and rights are 100% the same.:)
          http://websistent.com/fix-serial-port-permission-denied-errors-linux/

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #25

          @mrjj @Nimika Just a note: after adding currently logged on user to a group you do not have to reboot (its not Windows :-)) - just log out and log in again.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          N 1 Reply Last reply
          0
          • jsulmJ jsulm

            @mrjj @Nimika Just a note: after adding currently logged on user to a group you do not have to reboot (its not Windows :-)) - just log out and log in again.

            N Offline
            N Offline
            Nimika
            wrote on last edited by
            #26

            @jsulm Thank you!!
            But still in my case maybe RHEL is not allowing any other user to add in dialout group.

            mrjjM jsulmJ 2 Replies Last reply
            0
            • N Nimika

              @jsulm Thank you!!
              But still in my case maybe RHEL is not allowing any other user to add in dialout group.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #27

              @Nimika said in Serial Port configuration in RHEL:

              RHEL is not allowing any other user to add in dialout group.

              cant you just use sudo in front?

              1 Reply Last reply
              0
              • N Nimika

                @jsulm Thank you!!
                But still in my case maybe RHEL is not allowing any other user to add in dialout group.

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #28

                @Nimika RHEL works like any other Linux distribution. To add a user to a group you need to be root. You can either login as root, or just enter su in a terminal window enter your root password and then add the user to the group. su is used to become root in a shell (you need root password).
                @mrjj I think on RHEL sudo is usually not used, so sudo will probably not work (as far as I know, I could be wrong as I use Ubuntu).

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                N mrjjM 2 Replies Last reply
                0
                • jsulmJ jsulm

                  @Nimika RHEL works like any other Linux distribution. To add a user to a group you need to be root. You can either login as root, or just enter su in a terminal window enter your root password and then add the user to the group. su is used to become root in a shell (you need root password).
                  @mrjj I think on RHEL sudo is usually not used, so sudo will probably not work (as far as I know, I could be wrong as I use Ubuntu).

                  N Offline
                  N Offline
                  Nimika
                  wrote on last edited by
                  #29

                  @jsulm
                  Yeah I did all possibilities which I think can be done on RHEL.
                  By the way Thanks a lot for your all kind replies. :)

                  jsulmJ 1 Reply Last reply
                  0
                  • N Nimika

                    @jsulm
                    Yeah I did all possibilities which I think can be done on RHEL.
                    By the way Thanks a lot for your all kind replies. :)

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #30

                    @Nimika So, is your user now member of dialout group? You can check this executing "groups" command in a terminal (not as root but as the user who needs the access rights!). You can add a user to a group manually: open /etc/group file in an editor (as root), look for a line like "dialout:x:115:" and append user name at the end of that line.

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    N 1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #31

                      In addition to what my fellows already wrote, if you're not too found of manipulating your user setting with the command line, most of desktop environment (KDE, Gnome, etc.) provide user management software so you'll likely be able to add your user to the dialout group with them. They should ask for an admin password when required.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      1
                      • jsulmJ jsulm

                        @Nimika RHEL works like any other Linux distribution. To add a user to a group you need to be root. You can either login as root, or just enter su in a terminal window enter your root password and then add the user to the group. su is used to become root in a shell (you need root password).
                        @mrjj I think on RHEL sudo is usually not used, so sudo will probably not work (as far as I know, I could be wrong as I use Ubuntu).

                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #32

                        @jsulm
                        Oh, you are right. it might not be set up at all
                        https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/2/html/Getting_Started_Guide/ch02s03.html
                        so su is the way to go.

                        1 Reply Last reply
                        1
                        • jsulmJ jsulm

                          @Nimika So, is your user now member of dialout group? You can check this executing "groups" command in a terminal (not as root but as the user who needs the access rights!). You can add a user to a group manually: open /etc/group file in an editor (as root), look for a line like "dialout:x:115:" and append user name at the end of that line.

                          N Offline
                          N Offline
                          Nimika
                          wrote on last edited by
                          #33

                          @jsulm
                          No my user is not the member because its not working in the dialout group.
                          I did by editing to the group file as well. Whenever I am in my root and adding the user to the group it is showing that this user is already have the group.

                          @SGaist
                          which management software you are talking about??

                          mrjjM jsulmJ 2 Replies Last reply
                          0
                          • N Nimika

                            @jsulm
                            No my user is not the member because its not working in the dialout group.
                            I did by editing to the group file as well. Whenever I am in my root and adding the user to the group it is showing that this user is already have the group.

                            @SGaist
                            which management software you are talking about??

                            mrjjM Offline
                            mrjjM Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on last edited by
                            #34

                            @Nimika
                            HI
                            I think the champion means that many newer distros have also a GUI version
                            to change user / groups versus using the command line. :)

                            N 1 Reply Last reply
                            0
                            • N Nimika

                              @jsulm
                              No my user is not the member because its not working in the dialout group.
                              I did by editing to the group file as well. Whenever I am in my root and adding the user to the group it is showing that this user is already have the group.

                              @SGaist
                              which management software you are talking about??

                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by
                              #35

                              @Nimika Sorry, I don't understand. To add a user manually you open /etc/group file in a editor (you need to be root to edit this file). Look for the group "dialout" and append the username at the end of the line containing the group, like:

                              dialout:x:124:myuser
                              

                              This is how it works on UNIX/Linux since decades.
                              "it is showing that this user is already have the group" - what/who is showing this?

                              So, here what you should do:

                              $ su
                              ENTER YOUR ROOT PASSWORD
                              $ vim /etc/group
                              APPEND USERNAME AT THE END OF THEdialout LINE
                              SAVE THE FILE
                              CLOSE vim
                              

                              You can use another editor instead of vim.

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              1
                              • mrjjM mrjj

                                @Nimika
                                HI
                                I think the champion means that many newer distros have also a GUI version
                                to change user / groups versus using the command line. :)

                                N Offline
                                N Offline
                                Nimika
                                wrote on last edited by
                                #36

                                @mrjj
                                ok thank you. Let me check.

                                @jsulm
                                I mean the /etc/group file is already containing my user thats why terminal is showing the message.

                                jsulmJ 1 Reply Last reply
                                0
                                • N Nimika

                                  @mrjj
                                  ok thank you. Let me check.

                                  @jsulm
                                  I mean the /etc/group file is already containing my user thats why terminal is showing the message.

                                  jsulmJ Offline
                                  jsulmJ Offline
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #37

                                  @Nimika Then this user should now have access. The user needs to log out and log in again after adding him to a group.
                                  Does it work now?

                                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  N 1 Reply Last reply
                                  0
                                  • jsulmJ jsulm

                                    @Nimika Then this user should now have access. The user needs to log out and log in again after adding him to a group.
                                    Does it work now?

                                    N Offline
                                    N Offline
                                    Nimika
                                    wrote on last edited by
                                    #38

                                    @jsulm
                                    Sorry to say but still the same problem.

                                    1 Reply Last reply
                                    0
                                    • BuckwheatB Offline
                                      BuckwheatB Offline
                                      Buckwheat
                                      wrote on last edited by mrjj
                                      #39

                                      Some admins do not like you to cross groups (Like US GOV admins). You can, however, get them to make a UDEV rule that will set the permissions when the port is found. This is especially useful if you need many users to access the port.

                                      This is a more permanent solution than using rc.local to change port access modes as it will set the modes each time the port is plugged-in as well as when the computer is rebooted. Your admin should know how to do this. If you are the admin, there are plenty of technotes on adding rules to UDEV. You can even give the port a better, more consistent, name the ones the kernel provides as they can reorder at reboot, etc.

                                      In /etc/rules.d/my.rules /etc/udev/rules.d

                                      SUBSYSTEM=="tty", ENV{ID_PATH}=="pci-blah blah blah", MODE="0666", SYMLINK+="tty-my-device"

                                      The "pci-blah blah blah" can be found using udevadm info /dev/tty<device>

                                      Dave Fileccia

                                      BuckwheatB 1 Reply Last reply
                                      1
                                      • BuckwheatB Buckwheat

                                        Some admins do not like you to cross groups (Like US GOV admins). You can, however, get them to make a UDEV rule that will set the permissions when the port is found. This is especially useful if you need many users to access the port.

                                        This is a more permanent solution than using rc.local to change port access modes as it will set the modes each time the port is plugged-in as well as when the computer is rebooted. Your admin should know how to do this. If you are the admin, there are plenty of technotes on adding rules to UDEV. You can even give the port a better, more consistent, name the ones the kernel provides as they can reorder at reboot, etc.

                                        In /etc/rules.d/my.rules /etc/udev/rules.d

                                        SUBSYSTEM=="tty", ENV{ID_PATH}=="pci-blah blah blah", MODE="0666", SYMLINK+="tty-my-device"

                                        The "pci-blah blah blah" can be found using udevadm info /dev/tty<device>

                                        BuckwheatB Offline
                                        BuckwheatB Offline
                                        Buckwheat
                                        wrote on last edited by
                                        #40

                                        @Buckwheat Sorry, it is /etc/udev/rules.d

                                        Dave Fileccia

                                        1 Reply Last reply
                                        0

                                        • Login

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular
                                        • Users
                                        • Groups
                                        • Search
                                        • Get Qt Extensions
                                        • Unsolved