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
Solved

Creating an Account with some root permissions

Posted on 2000-03-01
4
212 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 20 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

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 …
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
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 get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

839 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