DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 8th January 2013
GullibleJones GullibleJones is offline
Port Guard
 
Join Date: Sep 2008
Posts: 13
Cool Getting hotplugd to work

I'm trying to make OpenBSD automount USB and optical media, so that I don't have to bother with kern.usermount and associated insecurity. Because I'm trying to keep things simple and avoid using regexps, I just want to mount stuff by device name.

My /etc/hotplug/attach file looks like this:

Code:
#!/bin/sh

DEVCLASS=$1
DEVNAME=$2

case $DEVCLASS in
2) # disk devices
        case $DEVNAME in
        sd1) # USB drives
                mount -o nodev,nosuid /dev/sd1i /mnt/flash
                ;;
        cd0) # CD drives
                mount -o nodev,nosuid /dev/cd0a /mnt/optical
                ;;
        esac
esac
This mounts the USB drive, but keeps it read-only for limited users. It never mounts optical media.

How can I get it to mount a CD or DVD? And what's the best way to apply sane permissions to the USB drive, without changing the permissions on the device node?

Edit: okay, major "Duh" moment on the USB permissions problem. The solution is to make the mount directory writeable by whoever needs to write to it.

Still haven't figured out the CD drive though.

Last edited by GullibleJones; 8th January 2013 at 10:01 PM. Reason: One problem solved.
Reply With Quote
  #2   (View Single Post)  
Old 9th January 2013
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,125
Default

The easiest way to solve the permission problem is to create a "mount" partition, inside the home partition. I am lazy to type so I use a directory called "U"
Code:
 $ sudo mount /dev/cd0a U
I modified your script:
Code:
#!/bin/sh

DEVCLASS=$1
DEVNAME=$2

case $DEVCLASS in
2) # disk devices
        case $DEVNAME in
        *)      echo $(date) : DEVCLASS: $DEVCLASS >>/tmp/debug.attach.txt 2>&1
                echo $(date) : DEVNAME : $DEVNAME >>/tmp/debug.attach.txt  2>&1
        esac
esac
When I plug in an USB memory stick I get this in /tmp/debug.attach:

Code:
[adriaan@hercules]~: cat /tmp/debug.attach.txt                                 
Wed Jan 9 02:41:21 CET 2013 : DEVCLASS: 2
Wed Jan 9 02:41:21 CET 2013 : DEVNAME : sd0
When I put a CD or DVD in my DVD rewriter nothing is being written to that file.
Even the following attach script does not produce anything on inserting a CD.
Code:
#!/bin/sh

cat <<END >>/tmp/debug.attach.txt
$(date)
--------------------------------
$(env)
--------------------------------
$(set)
--------------------------------
END
So no event is happening, thus no running of the script
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #3   (View Single Post)  
Old 9th January 2013
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,975
Default

The CD drive is not created by disc insertion. The cd0 drive already exists.

amd(8) might be a possible solution.
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
why won't my table work? tomp OpenBSD Security 3 25th August 2011 12:23 PM
nspluginwrapper not work... marduk NetBSD Installation and Upgrading 4 3rd January 2011 10:23 PM
ATI Catalyst.... Does it work? echoblack OpenBSD Installation and Upgrading 10 17th June 2009 09:04 AM
Crossplatform UI Work Turophile Programming 9 21st October 2008 11:56 PM
Getting Qt4 to work on FreeBSD enpey FreeBSD Ports and Packages 6 6th May 2008 07:20 AM


All times are GMT. The time now is 04:18 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick