Author Topic: Howto: Mount Smb/usb Rw For Non-root  (Read 2307 times)

ybiC

  • Newbie
  • *
  • Posts: 13
    • View Profile
Howto: Mount Smb/usb Rw For Non-root
« on: December 01, 2004, 03:54:11 pm »
On my Zaurus SL-6000L the non-privilaged user zaurus can (un)mount SD, MMC, and CF cards.  But it appears that you must be root to mount/unmount SMB shares and USB drives, and if mounted as root then all files on the mounted filesystem are owned by root, thus not writeable by the zaurus user.

I whipped up the following trivial shell scripts to scratch this itch, and thought they might be of some use to other Zaurites.

Place the scripts somewhere in your search path, make them executable using chmod, create the /mnt/usbstorage/ directory and call from a zaurus user console prompt.  You'll be prompted for root user password if you have one set.  I imagine that you could fully automate these scripts by using the credentials switch and file, and even make clickable icons.

Feedback is welcome, especially if there's some really simple factor that I've overlooked.


Code: [Select]
#!/bin/sh
# msmb
# mount an SMB share so that it's RW by non-privilaged "zaurus" user
/bin/su -c '/home/root/usr/bin/smbmount //host/share /mnt/smb -o username=user netbiosname=zaurus workgroup=workgroup uid=nnn gid=nnn' root
/bin/mount|grep host
Code: [Select]
#!/bin/sh
# musb
# mount a USB drive so that it's RW by non-privilaged "zaurus" user
/bin/su -c '/bin/mount /dev/sda1 /mnt/usbstorage -o uid=nnn gid=nnn' root
/bin/mount|grep usbstorage

Code: [Select]
#!/bin/sh
# usmb
# unmount the SMB share
/bin/su -c '/bin/umount /smb
/bin/mount|grep host
Code: [Select]
#!/bin/sh
# uusb
# unmount the USB drive
/bin/su -c '/bin/umount /dev/sda1' root
/bin/mount|grep usbstorage
SL-6000L, Sharp 1.12 ROM, expansion adapter
SocketIO low-power ethernet CF
Zthin serial console cable, iRiver USB host cable, Goldx quick-connect USB cable
SanDisk 128MB & 1GB SD, 256MB & 1GB CF cards, cruzer mini 256MB USB key