LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 10-18-2006, 08:40 PM   #1
greenRavens
LQ Newbie
 
Registered: Oct 2006
Posts: 1

Rep: Reputation: 0
non-root access to /proc/scsi/scsi


Hi,

I am trying to allow a non-root user to modify the /proc/scsi/scsi file using a command such as echo "scsi add-single-device 4 0 0 0" > /proc/scsi/scsi. I have removable SCSI drives and need to modify this real-time. I wrote a script for this access and gave it sudo priviledges but get the same error. I know this works under root but I want something non-root. Any ideas? Thanks.
 
Old 10-18-2006, 08:48 PM   #2
slantoflight
Member
 
Registered: Aug 2005
Distribution: Smoothwall
Posts: 283
Blog Entries: 3

Rep: Reputation: 35
chmod 777 /proc/scsi/scsi
 
Old 10-18-2006, 08:54 PM   #3
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
The chmod will work but presents lots of problems... allowing everyone to modify the file, if udev is used the chmod won't survive a reboot, and some programs might freak out by seeing odd permissions (like SELinux audit daemons or something similar).

The standard response is to give your user account sudo privileges to run the command. Though, that kind of modification might be ticky to articulate in the sudoers file.

The reason your script does not work is because Linux does not recognize the setuid bit on scripts (assuming you meant setuid instead of sudo).

However, you might be able to combine the two approaches. If the script works as you want, give your user sudo permission to run the script as root. That would be easier than writing a sudoers rule to let the user echo specific values to a /proc/scsi/scsi. I'm guessing the rule would look something like this:

Code:
username     ALL = (root) NOPASSWD: /path/to/script.bash
And would be used like this:
Code:
sudo -u root /path/to/script.bash arg1 arg2 ...
Disclaimer: I'm a relative novice using sudo. So I make no guarantees the solution above will work "out of the box."
 
Old 10-19-2006, 02:44 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,537

Rep: Reputation: 149Reputation: 149
Moved: This thread is more suitable in Linux-Software and has been moved accordingly to help your thread/question get the exposure it deserves.
 
  


Reply

Tags
proc, scsi


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I access my scsi hdd from dev/scsi/host1/bus0/target0/lun0 ?? marius7sv Linux - Hardware 0 09-06-2004 10:40 AM
Hotplug SCSI scanner or How to write to /proc/scsi/scsi from within a shell script. samac Linux - Hardware 1 08-30-2004 02:28 PM
Error editing /proc/scsi scsi file Thaidog Linux - Newbie 2 08-26-2004 08:19 AM
Some info about '/proc/scsi/scsi' and '/dev' C.Loko Slackware 4 11-27-2003 12:30 PM
allow non root users add devices to /proc/scsi/scsi ? ewto Linux - Newbie 5 10-14-2003 11:36 AM


All times are GMT -5. The time now is 03:04 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration