Linux: Unexpected rights during execution

34 views Asked by At

I am trying to connect to a COM port "TTYACM0" on a raspberry PI, but when I try to open it with my user, it fails. and when I execute as sudo it works well. I checked my user rights and it is in all groups needed:

user : user root tty dialout sudo i2c gpio

Here is the port:

crw-rw---- 1 root dialout 166,   0 Sep  7 12:26 ttyACM0

As the user is in dialout it should work.

The funny fact is that my application fails when I execute my application like this:

user$ ./application

And succeeds when I type this from the same prompt:

user$ su user -c './application'

I don't really understand the difference between the two lines. This application used to work before and works perfectly well before and also works on my linux Computer (both are compiled with QT), but this also concerns other applications like Putty. Can you help me on this?

Thank you!

ps: I am on the right user:

user$ whoami
user
1

There are 1 answers

0
larsks On

It looks like you have added yourself to the dialout group but you have not logged out and logged back in. The group credentials of your current session don't update dynamically. This is why su user -c ... works, because that starts a new session with your updated membership.

Log out, log back in, and things should work correctly.