DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD General

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

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 21st October 2008
rex rex is offline
Real Name: Nikhil Rathod
Shell Scout
 
Join Date: May 2008
Location: Chicago
Posts: 114
Thanked 2 Times in 2 Posts
Default Mounting USB as a normal user

http://www.freebsd.org/doc/en/books/...usb-disks.html

I followed the handbook to configure BDS to mount usb drives as a normal user. I'm able to do it just fine with root user. But some thing is wrong for normal user. user is of operator group.

Here is what I see when FreeBSD boots up.
Code:
/etc/rc: WARNING: devfs_set_ruleset: you must specify a ruleset number
/etc/rc: WARNING: devfs_apply_ruleset: you must specify a ruleset
This must be either because I added
Code:
[localrules=5]
add path 'da*' mode 0660 group operator
to /etc/devfs.rules

or

Code:
devfs_system_ruleset="localrules"
to /etc/rc.conf

Here is what I see when I try to mount USB drive
Code:
> mount -t msdosfs /dev/da4s1 /mnt/usb/
mount_msdosfs: /dev/da4s1: : Operation not permitted
Any suggestion what might be wrong over here?
Reply With Quote
  #2   (View Single Post)  
Old 21st October 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
formerly killasmurf86
 
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 588
Thanked 29 Times in 26 Posts
Default

install and configure sudo
That is one of the easiest ways to allow other users to mount usb....
Reply With Quote
  #3   (View Single Post)  
Old 21st October 2008
rex rex is offline
Real Name: Nikhil Rathod
Shell Scout
 
Join Date: May 2008
Location: Chicago
Posts: 114
Thanked 2 Times in 2 Posts
Default

Quote:
Originally Posted by killasmurf86 View Post
install and configure sudo
That is one of the easiest ways to allow other users to mount usb....
I'm not a big fan of sudo.
Reply With Quote
  #4   (View Single Post)  
Old 21st October 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
formerly killasmurf86
 
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 588
Thanked 29 Times in 26 Posts
Default

why? It's small, easy to config....
Reply With Quote
  #5   (View Single Post)  
Old 21st October 2008
rex rex is offline
Real Name: Nikhil Rathod
Shell Scout
 
Join Date: May 2008
Location: Chicago
Posts: 114
Thanked 2 Times in 2 Posts
Default

I don't know y? I guess because
1. I hate Ubuntu and I last used sudo in ubuntu. .
2. what I'm trying is from FreeBSD handbook and it is not working.
Reply With Quote
  #6   (View Single Post)  
Old 21st October 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
formerly killasmurf86
 
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 588
Thanked 29 Times in 26 Posts
Default

I tried making users able to mount usb (i fallowed some guild that involved AMD)
In the end i gave up....

sudo is really the best and easy to implement solution of the problem.
Reply With Quote
  #7   (View Single Post)  
Old 21st October 2008
rex rex is offline
Real Name: Nikhil Rathod
Shell Scout
 
Join Date: May 2008
Location: Chicago
Posts: 114
Thanked 2 Times in 2 Posts
Default

Quote:
Originally Posted by killasmurf86 View Post
I tried making users able to mount usb (i fallowed some guild that involved AMD)
In the end i gave up....

sudo is really the best and easy to implement solution of the problem.
Just what I wanted to know, that it is not working for others too.

OK what I need to do apart for installing sudo, also what is the difference between sudo and su? Asking because from what I remember from my Ubuntu experience we use sudo followed by some command and then we need to enter the password. If there is no escape from entering password then why not use "su".
Reply With Quote
  #8   (View Single Post)  
Old 21st October 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
formerly killasmurf86
 
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 588
Thanked 29 Times in 26 Posts
Default

sudo allows to execute 1 command as root
su - Switch User, name speaks for itself

with sudo you need to type your own password
with so you need to enter target user password

sudo can be configured to only allow specific commands (even with specific command line options) for specific users/groups
su, can't be configured this way, it will just let you be target user

giving root password to others is stupid thing to do
so natural choice is sudo
Reply With Quote
  #9   (View Single Post)  
Old 21st October 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Thanked 112 Times in 104 Posts
Default

Just curious, what is the permissions on /mnt/usb/?
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
Old 21st October 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
formerly killasmurf86
 
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 588
Thanked 29 Times in 26 Posts
Default

Quote:
Originally Posted by TerryP View Post
Just curious, what is the permissions on /mnt/usb/?
The thing is in different place....

/dev/daX are reated dynamically
so simple /etc/devfs.conf rules won't apply to them.

you need to fetch moment when /dev/daX is created and then change permissions for it, so user can access it (otherwise by default it's root/wheel)....
That's the hard part....
that's why simply giving user permissions to write to /mnt/usb won't work.
Reply With Quote
Old 21st October 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,135
Thanked 182 Times in 149 Posts
Default

Something is wrong with your devs.fs rule. Please post the complete /etc/devs.fs file.

Did you set vfs.usermount=1 as outlined by the FreeBSD handbook?
__________________
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
Old 21st October 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
formerly killasmurf86
 
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 588
Thanked 29 Times in 26 Posts
Default

Quote:
Originally Posted by J65nko View Post
Something is wrong with your devs.fs rule. Please post the complete /etc/devs.fs file.

Did you set vfs.usermount=1 as outlined by the FreeBSD handbook?
yes, i did set vfs.usermount=1, but now i have fresh install, and i already didn't try this for some 2-4 previous installs

currently i ain't got /etc/devs.fs
Reply With Quote
Old 21st October 2008
rex rex is offline
Real Name: Nikhil Rathod
Shell Scout
 
Join Date: May 2008
Location: Chicago
Posts: 114
Thanked 2 Times in 2 Posts
Default

Quote:
Originally Posted by J65nko View Post
Did you set vfs.usermount=1 as outlined by the FreeBSD handbook?
Yes I did too. I've gone through 3 to 4 times to see if I'm missing something, but no luck.

Also /mnt/usb is owned by the user trying to mount the usb drive. If it can't be done like this then shouldn't they remove this topic from the handbook.
Reply With Quote
Old 21st October 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
formerly killasmurf86
 
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 588
Thanked 29 Times in 26 Posts
Default

Quote:
Originally Posted by J65nko View Post
Something is wrong with your devs.fs rule. Please post the complete /etc/devs.fs file.

Did you set vfs.usermount=1 as outlined by the FreeBSD handbook?
Holly cow, i just made it
For the 1st time, ever since i use FreeBSD i was able to mount drive as simple user without sudo
Woooooooot
[it took me 3-4 restarts this time]

Thanks given out to rex for starting this and J65nko, for his useful (i mean it, if not you, i wouldn't bother again) post
Reply With Quote
Old 21st October 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Thanked 112 Times in 104 Posts
Default

@killasmurf86 I was operating under the assumption that the permissions for the device were already set by then, but hey... you know what they say about making assumptions :\
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
Old 21st October 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,135
Thanked 182 Times in 149 Posts
Default

Rex, you have to fix the/etc/rc: WARNING: devfs_set_ruleset: you must specify a ruleset number
/etc/rc: WARNING: devfs_apply_ruleset: you must specify a ruleset
errors.

Secondly:
After you mounted the USD device, what is the output of ?
Code:
# ls -l /dev/da*
__________________
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
Old 21st October 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
formerly killasmurf86
 
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 588
Thanked 29 Times in 26 Posts
Default

Quote:
Originally Posted by J65nko View Post
Rex, you have to fix the/etc/rc: WARNING: devfs_set_ruleset: you must specify a ruleset number
/etc/rc: WARNING: devfs_apply_ruleset: you must specify a ruleset
errors.

Secondly:
After you mounted the USD device, what is the output of ?
Code:
# ls -l /dev/da*
speaking about numbers
it worked for me when i used
[localrules=10]
dunno, if tat is the case....


too bad, you need to create 1 folder per user that you want to be able to mount
Reply With Quote
Old 21st October 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,135
Thanked 182 Times in 149 Posts
Default

Quote:
Originally Posted by killasmurf86 View Post
Too bad, you need to create 1 folder per user that you want to be able to mount
I am the only user on my sytems, but I use a /home/j65nko/usb mount directory.
__________________
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
Old 21st October 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
formerly killasmurf86
 
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 588
Thanked 29 Times in 26 Posts
Default

Quote:
Originally Posted by J65nko View Post
I am the only user on my sytems, but I use a /home/j65nko/usb mount directory.
What i mean, is it's pretty inflexible way
But with a little script you can fix that, can't you?



EDIT:
hmmm, i figured good thing, to try add relative path to fstab AND IT WORKED
now i can mount ./usb



EDIT2: I'm so happy


EDIT3: hey, is there a way to make mount auto detect filesystem on usb stick?
i'd really love to have auto in /etc/fstab

Last edited by graudeejs; 21st October 2008 at 10:09 PM.
Reply With Quote
Old 22nd October 2008
rex rex is offline
Real Name: Nikhil Rathod
Shell Scout
 
Join Date: May 2008
Location: Chicago
Posts: 114
Thanked 2 Times in 2 Posts
Default

Quote:
Originally Posted by J65nko View Post
Something is wrong with your devs.fs rule. Please post the complete /etc/devs.fs file.

Did you set vfs.usermount=1 as outlined by the FreeBSD handbook?
I too don't have /etc/dsvs.fs

Quote:
Originally Posted by J65nko
After you mounted the USD device, what is the output of ?
Code:
REX# ls -l /dev/da*
crw-r-----  1 root  operator    0, 106 Oct 21 20:51 /dev/da0
crw-r-----  1 root  operator    0, 107 Oct 21 20:51 /dev/da1
crw-r-----  1 root  operator    0, 108 Oct 21 20:51 /dev/da2
crw-r-----  1 root  operator    0, 109 Oct 21 20:51 /dev/da3
crw-r-----  1 root  operator    0, 115 Oct 21 20:51 /dev/da4
crw-r-----  1 root  operator    0, 116 Oct 21 20:51 /dev/da4s1
REX#
here da4 is my usb drive da0-3 are the card readers.

Quote:
Originally Posted by killasmurf86
Holly cow, i just made it
For the 1st time, ever since i use FreeBSD i was able to mount drive as simple user without sudo
Woooooooot
[it took me 3-4 restarts this time]

Thanks given out to rex for starting this and J65nko, for his useful (i mean it, if not you, i wouldn't bother again) post
You are making me jealous
Reply With Quote
Reply

Tags
mount usb, usb, vfs.usermount

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
HOWTO: mounting an USB device as normal non-root user in OpenBSD J65nko Guides 4 24th December 2008 01:43 AM
How to Run K3B with normal user openBSD 4.4 mfaridi OpenBSD General 6 12th November 2008 10:25 PM
Wireshark not run in normal user mfaridi FreeBSD Ports and Packages 2 7th November 2008 09:49 PM
Mounting samba share as normal user rex FreeBSD General 4 27th October 2008 05:17 PM
command launched by normal user... maurobottone OpenBSD General 4 1st June 2008 03:45 AM


All times are GMT. The time now is 07:18 PM.


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