Solved

Creating an Account with some root permissions

Posted on 2000-03-01
4
202 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
Comment Utility
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
Comment Utility
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 20 total points
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now