Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


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

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


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, 09:48 PM   #2
Registered: Aug 2005
Distribution: Smoothwall
Posts: 283
Blog Entries: 3

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

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
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:

username     ALL = (root) NOPASSWD: /path/to/script.bash
And would be used like this:
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, 03:44 PM   #4
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,547

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


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 11: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 03:28 PM
Error editing /proc/scsi scsi file Thaidog Linux - Newbie 2 08-26-2004 09:19 AM
Some info about '/proc/scsi/scsi' and '/dev' C.Loko Slackware 4 11-27-2003 01:30 PM
allow non root users add devices to /proc/scsi/scsi ? ewto Linux - Newbie 5 10-14-2003 12:36 PM

All times are GMT -5. The time now is 07:24 PM.

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