Re: How to mount USB key

2007-06-07 Thread Reid Linnemann

Written by ajm on 06/06/07 20:56

On Wed, Jun 06, 2007 at 01:21:56PM -0400, Mike Jeays wrote:

On Wednesday 06 June 2007 12:57, Oscar Chavarria wrote:

I want to copy files to it. I introduced the key and was recognized as da0.

I did ls dev/da0 == dev/da0

Then

mount /dev/da0 /home == incorrect super block.

Thank you in advance for any help.

If it is a DOS-format device, you need to say
mount -t mdsos /dev/da0 /mnt
or maybe
mount -t msdos /dev/da0s1 /mnt




In my /etc/sysctl.conf file I have the following:

---
# user mounts devices
vfs.usermount=1
---

In my /usr/local/etc/sudoers file I have the following:

---
# Defaults specification
Defaults env_reset
Defaults timestamp_timeout=0
Defaults tty_tickets
Defaults requiretty
Defaults passwd_timeout=1

# User privilege specification
alex  ALL=/sbin/umount,\
/sbin/mount_msdosfs
---

I have added user alex to the wheel group

To mount the device as regular user (alex), I created a sub-directory in
my home directory.  

In this example, my home directory is   alexand the 
sub-directory is mnt_drive


Execute the following to mount the drive...considering that /dev/da0 is 
the drive to mount.


sudo mount_msdosfs /dev/da0 /usr/home/alex/mnt_drive

Execute the following to un-mount the drive

sudo umount /usr/home/alex/mnt_drive

Hope it helps...



Just a side note, as so many users do not realize this when doing 
non-root mounts... the non-root user _must_ own the mountpoint. It 
doesn't matter if you've chmod 0777ed it or not, if your user does not 
own the mountpoint you will not be able to perform the user mount.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to mount USB key

2007-06-06 Thread Jonathan Horne

On 6/6/07 11:57 AM, Oscar Chavarria [EMAIL PROTECTED] wrote:

 I want to copy files to it. I introduced the key and was recognized as da0.
 
 I did ls dev/da0 == dev/da0
 
 Then
 
 mount /dev/da0 /home == incorrect super block.
 
 Thank you in advance for any help.

try:

Mount_msdosfs /dev/da0 /mountpoint

You might not want to mount it to /home, as home is a link to /usr/home.

Cheers,
-- 
Jonathan Horne 
[EMAIL PROTECTED]
http://dfwlpiki.dfwlp.org



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to mount USB key

2007-06-06 Thread Mike Jeays
On Wednesday 06 June 2007 12:57, Oscar Chavarria wrote:
 I want to copy files to it. I introduced the key and was recognized as da0.

 I did ls dev/da0 == dev/da0

 Then

 mount /dev/da0 /home == incorrect super block.

 Thank you in advance for any help.

If it is a DOS-format device, you need to say
mount -t mdsos /dev/da0 /mnt
or maybe
mount -t msdos /dev/da0s1 /mnt


-- 
Mike Jeays
http://www.jeays.ca
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to mount USB key

2007-06-06 Thread Roland Smith
On Wed, Jun 06, 2007 at 10:57:57AM -0600, Oscar Chavarria wrote:
  I want to copy files to it. I introduced the key and was recognized as da0.
 
  I did ls dev/da0 == dev/da0
 
  Then
 
  mount /dev/da0 /home == incorrect super block.

You're trying to mount the drive as a UFS filesystem; this is the
default for mount.

Are there no other devices starting with da0? Because usually USB
keydrives are partitioned and then the first partition is formatted as
FAT32. So you probably want /dev/da0s1, or sometimes /dev/da0s4 if it exists.

It is also not a good idea to mount on /home, because it will mask your
home directory.

If you want to mount a disk as a normal user instead of root, there are
some things that need to be set up correctly, see below.

It's better to use something like:

mount_msdosfs -m 644 -M 755 -o noatime,noexec,nosuid,sync /dev/da0s1 /mnt/mydir

I've written a small shell script to do this for me;


#!/bin/sh
# Mount a thumbdrive with a MSDOS filesystem
DIR=/mnt/$USER
DEV=/dev/da0s1

# It is assumed that $DIR exists, and is owned by $USER.

# Check if $DIR is already used.
if mount|grep $DIR /dev/null; then
echo $DIR is already mounted!
exit 1;
fi

# Check if $DEV is available.
if ! ls $DEV /dev/null 21; then
echo $DEV does not exist!
exit 1;
fi

# Everything OK, try to mount.
mount_msdosfs -m 644 -M 755 -o noatime,noexec,nosuid,sync $DEV $DIR


N.B.:
- /mnt/$USER should be an existing directory, and that you should be
  it's owner. 
- the script will fail if there is already an USB disk attached. 
  (it should use da1s1 in that case)
- the sysctl vfs.usermount should be set to 1 to allow normal users to
  mount filesystems
- the permissions on the /dev/da0 device whould be set such as to allow
  you access. See http://www.xs4all.nl/~rsmith/freebsd/index.html#devfs

Roland
-- 
R.F.Smith   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)


pgpNOKFvItepo.pgp
Description: PGP signature


Re: How to mount USB key

2007-06-06 Thread ajm
On Wed, Jun 06, 2007 at 01:21:56PM -0400, Mike Jeays wrote:
 On Wednesday 06 June 2007 12:57, Oscar Chavarria wrote:
  I want to copy files to it. I introduced the key and was recognized as da0.
 
  I did ls dev/da0 == dev/da0
 
  Then
 
  mount /dev/da0 /home == incorrect super block.
 
  Thank you in advance for any help.
 
 If it is a DOS-format device, you need to say
 mount -t mdsos /dev/da0 /mnt
 or maybe
 mount -t msdos /dev/da0s1 /mnt
 
 

In my /etc/sysctl.conf file I have the following:

---
# user mounts devices
vfs.usermount=1
---

In my /usr/local/etc/sudoers file I have the following:

---
# Defaults specification
Defaults env_reset
Defaults timestamp_timeout=0
Defaults tty_tickets
Defaults requiretty
Defaults passwd_timeout=1

# User privilege specification
alex  ALL=/sbin/umount,\
/sbin/mount_msdosfs
---

I have added user alex to the wheel group

To mount the device as regular user (alex), I created a sub-directory in
my home directory.  

In this example, my home directory is   alexand the 
sub-directory is mnt_drive

Execute the following to mount the drive...considering that /dev/da0 is 
the drive to mount.

sudo mount_msdosfs /dev/da0 /usr/home/alex/mnt_drive

Execute the following to un-mount the drive

sudo umount /usr/home/alex/mnt_drive

Hope it helps...

-- 
Alexander
FreeBSD 6.0-RELEASE i386
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]