tarik
tarik

Reputation: 83

Using Serial Ports like /dev/ttyS0 with simple user permisions

I'm on UBUNTu 12.04. I would like to run a program in user-mode (To be precise, a java program) that uses the PC's serial port. Opening the serial port /dev/ttyS0, it always throws a port busy exception what is not very true:

It just can not use the port because of permissions. The port belongs to root / dialout. When I manually set the group of ttyS0 to the group the user belongs to, it works well. But there are 2 disadvantages in:

Questions are:

How to manage, that a program with user rights is allowed to access serial ports without (too much) demanding activities of the user? Solutions inside and outside the java program are welcome :-)

Cheers, Tarik

Upvotes: 1

Views: 830

Answers (1)

Dirk
Dirk

Reputation: 10958

In the case you described you should add your user to the dialout group. Groups are often used to give users specific access rights, e.g. read/write access to device files.

I don't see a simple solution when you want to distribute your software. The administrator of the system is responsible for setting up user and group relations and to make sure that the users have the necessary rights to execute programs.

Upvotes: 2

Related Questions