Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-12-2008, 10:44 AM   #1
LQ Newbie
Registered: Jun 2008
Posts: 2

Rep: Reputation: 0
Reading and Writing to a Serial Port without SU


I am working with an application that needs to read and write to a serial port. Security is a major concern for this application, so I am having problems deciding what is the best way to allow a user without admin privileges to run the program. My experience with Linux is fairly limited.

I'm using Red Hat Enterprise Linux 4. When I do an ls -l /dev/ttyS*, all of them belong to the uucp group. I'm assuming I could just add the users to the uucp group, but that may introduce security vulnerabilities.

Alternatively, i've come across setuid() while searching for a solution, but that seems like another security problem, especially since my programming skills are sketchy, at best.

I should also add, the language being used is C.

Any advice would be greatly appreciated.

Thanks in advance!
Old 06-12-2008, 01:49 PM   #2
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
It is pretty easy to modify the ownership, group ownership, and privilege levels of the serial ports. Treat them like files, really. Create a group that includes the users that are permitted to use the port(s), and give the port(s) that group ownership.
--- rod.
Old 06-16-2008, 09:16 AM   #3
LQ Newbie
Registered: Jun 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks Rod, sounds like great advice! I especially like it because it is simple and easy to implement.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Facing problems in reading from and writing to serial port. vineel Linux - Hardware 2 02-27-2008 02:18 PM
reading from serial port IC009562 Linux - Software 2 11-08-2007 11:25 PM
writing to serial port sea waves Programming 6 05-08-2007 11:59 AM
Having trouble reading from serial port glo Linux - Newbie 0 02-09-2007 10:42 AM
reading and writing to a serial device (modem) Xanadu Linux - Laptop and Netbook 0 01-04-2005 10:05 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:20 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration