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.
  • N Offline
    N Offline
    Nimika
    wrote on last edited by
    #9

    how will I get to know wo is accessing that device?
    how can I add the user to the group which you have specified.

    jsulmJ 1 Reply Last reply
    0
    • N Nimika

      how will I get to know wo is accessing that device?
      how can I add the user to the group which you have specified.

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

      @Nimika The user using your application needs access right for /dev/ttyS0.
      If you execute the command @SGaist provided you you will see who has access. Check which group is set for that device. Then add yourself to this group (see /etc/group file).

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

      N 1 Reply Last reply
      1
      • jsulmJ jsulm

        @Nimika The user using your application needs access right for /dev/ttyS0.
        If you execute the command @SGaist provided you you will see who has access. Check which group is set for that device. Then add yourself to this group (see /etc/group file).

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

        @jsulm Hey thanks!
        I am getting this after writing the calling function ls -la /dev/ttyS0:
        crw-rw----. 1 root dialout 4, 64 Oct 7 10:35 /dev/ttyS0

        What does it mean?

        jsulmJ 1 Reply Last reply
        0
        • N Nimika

          @jsulm Hey thanks!
          I am getting this after writing the calling function ls -la /dev/ttyS0:
          crw-rw----. 1 root dialout 4, 64 Oct 7 10:35 /dev/ttyS0

          What does it mean?

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

          @Nimika That means that user root and group dialout have read/write access, nobody else have any access.
          So you either start your app as root, or (much better) add the user you're using (hopefully not root) to the group dialout.

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

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

            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.

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

            N 1 Reply Last reply
            2
            • N Offline
              N Offline
              Nimika
              wrote on last edited by
              #14

              Thankyou both of you.
              Please tell me how to add my normal user to the dialout group?
              What is dialout group?

              mrjjM jsulmJ 2 Replies Last reply
              1
              • K Offline
                K Offline
                kuzulis
                Qt Champions 2020
                wrote on last edited by
                #15

                QIODevice::OpenMode mode = QIODevice::ReadOnly | QIODevice::Unbuffered;

                Did you read documentation? QIODevice::Unbuffered it is unsupported mode.

                N 1 Reply Last reply
                1
                • K kuzulis

                  QIODevice::OpenMode mode = QIODevice::ReadOnly | QIODevice::Unbuffered;

                  Did you read documentation? QIODevice::Unbuffered it is unsupported mode.

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

                  @kuzulis Yeah I made it as comment.

                  1 Reply Last reply
                  0
                  • N Nimika

                    Thankyou both of you.
                    Please tell me how to add my normal user to the dialout group?
                    What is dialout group?

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

                    @Nimika

                    • Please tell me how to add my normal user to the dialout group?
                      sudo usermod -a -G dialout theuser

                    • What is dialout group?
                      Its a predefined group found in many distros.
                      From old times it was used to allowed modems
                      to make connection etc. ( ie allow the user to connect to the internet :)

                    So often the system has this group and any user in it, have access to /dev/ttySX

                    N 1 Reply Last reply
                    1
                    • N Nimika

                      Thankyou both of you.
                      Please tell me how to add my normal user to the dialout group?
                      What is dialout group?

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

                      @Nimika You really should learn how user/groups and access rights management is working on UNIX/Linux.

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

                      1 Reply Last reply
                      1
                      • N Offline
                        N Offline
                        Nimika
                        wrote on last edited by
                        #19

                        @jsulm Actually my system is Red Hat Enterprise Linux based so it is different to use its commands.

                        1 Reply Last reply
                        0
                        • mrjjM mrjj

                          @Nimika

                          • Please tell me how to add my normal user to the dialout group?
                            sudo usermod -a -G dialout theuser

                          • What is dialout group?
                            Its a predefined group found in many distros.
                            From old times it was used to allowed modems
                            to make connection etc. ( ie allow the user to connect to the internet :)

                          So often the system has this group and any user in it, have access to /dev/ttySX

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

                          @mrjj Thank you !! let me add it now and search whether it will work or not.....

                          mrjjM 1 Reply Last reply
                          0
                          • N Nimika

                            @mrjj Thank you !! let me add it now and search whether it will work or not.....

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

                            @Nimika
                            Np. as far as I can see it's the same for Red Hat with ttySX access, so there is
                            tons on google on the topic on allowing user X to read and write to /dev/ttSxxx
                            stuff.
                            http://ithelpblog.com/os/linux/bashandscripts/howto-add-user-to-group-on-linux-redhat-rhel-centos-fedora/

                            1 Reply Last reply
                            1
                            • 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

                                          • Login

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