Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm writing an application to read/write to/from a serial port in Fedora14, and it works great when I run it as root. But when I run it as a normal user I'm unable to obtain the privileges required to access the device (/dev/ttySx). That's kind of crappy because now I can't actually debug the damn thing using Eclipse.

I've tried running Eclipse with sudo but it corrupts my workspace and I can't even open the project. So I'd like to know if it's possible to lower the access requirements to write to /dev/ttySx so that any normal user can access it. Is this possible?

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

The right to access a serial port is determined by the permissions of the device file (e.g. /dev/ttyS0). So all you need to do is either arrange for the device to be owned by you, or (better) put yourself in the group that owns the device, or (if Fedora supports it, which I think it does) arrange for the device to belong to the user who's logged in on the console.

For example, on my system (not Fedora), /dev/ttyS0 is owned by the user root and the group dialout, so to be able to acesss the serial device, I would add myself to the dialout group:

usermod -a -G dialout MY_USER_NAME
share|improve this answer
    
I'm going to accept this one since it got me on the right path. For Fedora, the command usermod is used after a user has been created. The group in question was also dialout for me: sudo usermod -a -G dialout <username>. Cheers. –  iegod Jun 3 '11 at 20:24
add comment

Many distributions use group memberships to enable access to serial ports. I don't know details for Fedora offhand, though.

share|improve this answer
add comment

I think you can add yourself in sudoers file which will allow you to specify a set of commands as command alias which you would be able to execute without password. You can find an excellent tutorial about sudoers file in Ubuntu docs.

You can then run eclipse normally and it'd be able to execute those specific commands without root permissions.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.