Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Creating an Account with some root permissions

Posted on 2000-03-01
4
Medium Priority
?
223 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

722 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