Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Creating an Account with some root permissions

Posted on 2000-03-01
4
Medium Priority
?
224 Views
Last Modified: 2013-12-16
Hi there,

I'm using linux to communicate with external devices by serial or parallel ports. However, I must be root or set root permissions to my prog for accessing to these io ports. What I would like is to create an account which has root permissions for io ports but not for the rest such as accessing in Write mode to system files or accessing to /root directory.

How could I do this ?
0
Comment
Question by:daanen
4 Comments
 
LVL 1

Expert Comment

by:bcoleman
ID: 2573403
All you have to do is change ownership and permission for the /dev/{whatever port} to the user.  What you might want to do is set up a group which have permission to access the ports and put those users who need access in that group.
0
 
LVL 3

Expert Comment

by:jyu_88
ID: 2573595
alternatively, you can use 'sudo' program to explicitly grant certain user/group to run a single program/a set of programs as root.
0
 
LVL 2

Accepted Solution

by:
Reinier earned 80 total points
ID: 2597141
Or you can create a special group for these devices. Say you want to give rw access to /dev/ttyS3 and /dev/ttyS4. Then you add a new group named "devusers" or whatever in /etc/group and /etc/gshadow, like this:

groupadd -g 300 devusers

The exact name and group numerical id are not important, but they must be unique. Next you have to add root and all usernames of the users that must acces the device, to this group. You can do this by hand-editing /etc/group, but you can probabely also use linuxconf or whatever setuptool that comes with your distro.

Then go to /dev, do

chown root:devusers ttyS[34]
chmod 664 ttyS[34]

and you're set.
0
 

Author Comment

by:daanen
ID: 2599453
Thanks for these answers. As I'm the unique user of my linux box, I just chmod 666 /dev/ttyS*. But in the future, I'll probably use Reinier's solution
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question