Re: Auto Mount USB

2008-08-19 Thread Lowell Gilbert
Brian Miller [EMAIL PROTECTED] writes:

 Not a big deal. I will be sure to just mount and dismount the USB drives
 manually. They are just there to store a config and log backup on the
 firewall. I am doing this so that if I have a failure or attack or some
 other type of crash. I will be able to check out the latest config and
 logs. A cron job is scheduled to copy these files to the USB drive every
 so often.

For this sort of thing, I would recommend using mtools (available in a
port).  Mounting the disk shouldn't be necessary for copying one file
to removable storage.

Definitely consider logging to a remote machine, though.  It will be
considerably more secure.  (There's no reason you can't do both, and
get the advantages of each.)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Auto Mount USB

2008-08-18 Thread Bill Moran
In response to Brian Miller [EMAIL PROTECTED]:
 
 I can mount the drive just fine with the mount command. I also was able
 to add it to the fstab and have it mount at boot.
 
 However if the drive is removed it has to be mounted again. How do you
 get it to mount back up with out having to run the mount command again?

You're slightly off course.  Read man 8 amd and see if that helps.  Also,
section 27.3.5 of the handbook:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-nfs.html
If you get stuck on specifics, ask here.

 Also I noticed while playing with it that the device assignment keeps
 changing each time it is plugged back into the system. Started with
 /dev/da0s1, then da1s1, then da2s1, da3s1 and so on. Which means I have
 to change my mount comand every time.

I've not see this happen.  Are you umounting it before you remove the
drive?  If not, then the drive is still mounted from a previous connection
(even though it can't be accessed) so the system has to grab the next
available device.

This will go away once you have amd running.

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


RE: Auto Mount USB

2008-08-18 Thread Brian Miller
I started looking at amd and it is just what I need but it doesn't
appear to be available? From what I have read it should be part of
FreeBSD? I see that I can download a tar from www.am-utils.org should I
do that or is there a Package available for it? Is there something
similar to YUM for FreeBSD?

You are correct that I was not dismounting then removing the drive. So
that makes sense. Next question is how/can I free them up? Tried umount
/dev/da0s1 but it fails with Device not configured

Thanks for the response.

-Original Message-
From: Bill Moran [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 18, 2008 12:27 PM
To: Brian Miller
Cc: freebsd-questions@freebsd.org
Subject: Re: Auto Mount USB

In response to Brian Miller [EMAIL PROTECTED]:
 
 I can mount the drive just fine with the mount command. I also was
able
 to add it to the fstab and have it mount at boot.
 
 However if the drive is removed it has to be mounted again. How do you
 get it to mount back up with out having to run the mount command
again?

You're slightly off course.  Read man 8 amd and see if that helps.
Also,
section 27.3.5 of the handbook:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-nfs.ht
ml
If you get stuck on specifics, ask here.

 Also I noticed while playing with it that the device assignment keeps
 changing each time it is plugged back into the system. Started with
 /dev/da0s1, then da1s1, then da2s1, da3s1 and so on. Which means I
have
 to change my mount comand every time.

I've not see this happen.  Are you umounting it before you remove the
drive?  If not, then the drive is still mounted from a previous
connection
(even though it can't be accessed) so the system has to grab the next
available device.

This will go away once you have amd running.

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


Re: Auto Mount USB

2008-08-18 Thread Wojciech Puchar



However if the drive is removed it has to be mounted again. How do you

first - it has to be unmounted before removal
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Auto Mount USB

2008-08-18 Thread Gaye Abdoulaye Walsimou
This question comes so often that I think this feature has to be by 
default installed/configured

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


Re: Auto Mount USB

2008-08-18 Thread Bill Moran
In response to Brian Miller [EMAIL PROTECTED]:

 I started looking at amd and it is just what I need but it doesn't
 appear to be available? From what I have read it should be part of
 FreeBSD? I see that I can download a tar from www.am-utils.org should I
 do that or is there a Package available for it? Is there something
 similar to YUM for FreeBSD?

Actually, I found this spiffy port while looking for a good reference
to point you to: cd /usr/ports/sysutils/automounter  make install
then read man automounter for setup instructions.

Keep in mind that the reason this is less than simple is because
automatically mounting removable media is a huge security risk.  The
fact that it's so convenient that most people ignore the security
risk does not mitigate the risk in any way.

 You are correct that I was not dismounting then removing the drive. So
 that makes sense. Next question is how/can I free them up? Tried umount
 /dev/da0s1 but it fails with Device not configured

umount the mountpoint, not the device.  I.e. umount /usr, not /dev/ad0s1g

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


Re: Auto Mount USB

2008-08-18 Thread Kevin Kinsey

Brian Miller wrote:

I started looking at amd and it is just what I need but it doesn't
appear to be available? From what I have read it should be part of
FreeBSD? I see that I can download a tar from www.am-utils.org should I
do that or is there a Package available for it? Is there something
similar to YUM for FreeBSD?


It's part of the base system:

[53] Mon 18.Aug.2008 14:52:41
[EMAIL PROTECTED]
# which amd
/usr/sbin/amd

[54] Mon 18.Aug.2008 14:53:05
[EMAIL PROTECTED] 
# whereis amd

amd: /usr/sbin/amd /usr/share/man/man8/amd.8.gz /usr/src/usr.sbin/amd

... and, according to the manpage, has been since before FreeBSD
existed.  CVS seems to concur, with the initial revision of amd.c
being committed by rgrimes@ on May 26, 1994.

Kevin Kinsey
--
Try to get all of your posthumous medals in advance.

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


Re: Auto Mount USB

2008-08-18 Thread Roland Smith
On Mon, Aug 18, 2008 at 12:06:38PM -0400, Brian Miller wrote:
 All,
 
 Not sure how to word all of this. I am trying to auto mount my USB tumb
 drive in FreeBSD (The version that comes with PFSense) I believe most of
 my troubles are related to lack of knowledge.
 
 I can mount the drive just fine with the mount command. I also was able
 to add it to the fstab and have it mount at boot.
 
 However if the drive is removed it has to be mounted again. How do you
 get it to mount back up with out having to run the mount command again?

You'd have to use an automounter, like amd(8) that comes with FreeBSD.  
 
 Also I noticed while playing with it that the device assignment keeps
 changing each time it is plugged back into the system. Started with
 /dev/da0s1, then da1s1, then da2s1, da3s1 and so on. Which means I have
 to change my mount comand every time.

This should not happen. The devfs filesystem that FreeBSD uses removes
device nodes if the devices are removed (unless the devices are still in
use). 

Are you unmounting the filesystem on the thumbdrive before removing the
drive from the USB port? If not this could be the cause of the
problem. Note that removing a mounted drive can crash your system!
_Always_ unmount a filesystem _before_ removing the device it is on.

[As an aside, FreeBSD's disk device drivers and filesystems predate hot
removeable devices by a considerable margin; they were written with the
(implicit) assumption that disk devices are not removed while the system
is running. Although work has been done in DragonflyBSD (a derivative of
FreeBSD 4) to fix this, those changes haven't made it into FreeBSD 6/7.x.]

If you have device nodes for devices that aren't there anymore, you can
try running 'camcontrol rescan all' as root.

If the filesystem on the thumbdrive has a label FOO, you should see that
label as a device node in /dev/msdosfs/FOO (for FAT* filesystems) or
/dev/ufs/FOO (for UFS formatted drives). Unlike the da devices this
doesn't depend on the sequence in which devices are plugged in. Labels
can be made with tunefs(8) (for UFS filesystems) or newfs_msdos(8) for
msdos filesystems.

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)


pgpOZjvCHeliP.pgp
Description: PGP signature


RE: Auto Mount USB

2008-08-18 Thread Brian Miller
Thanks for the feedback

Keep in mind the original post I indicated that I was running a version
installed by the pfsense firewall installation ISO(www.pfsense.org) 

Looks like it is drastically trimmed down version of BSD 6.2 many
commands are missing. Man, amd, camcontrol, etc. Also the I can't get
the pkg_add to install packages. I think because pfSense is using it for
it's own package store. 

Yes you are correct; I was just pulling out the drive with out
dismounting. 

Not a big deal. I will be sure to just mount and dismount the USB drives
manually. They are just there to store a config and log backup on the
firewall. I am doing this so that if I have a failure or attack or some
other type of crash. I will be able to check out the latest config and
logs. A cron job is scheduled to copy these files to the USB drive every
so often.




-Original Message-
From: Roland Smith [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 18, 2008 4:11 PM
To: Brian Miller
Cc: freebsd-questions@freebsd.org
Subject: Re: Auto Mount USB

On Mon, Aug 18, 2008 at 12:06:38PM -0400, Brian Miller wrote:
 All,
 
 Not sure how to word all of this. I am trying to auto mount my USB
tumb
 drive in FreeBSD (The version that comes with PFSense) I believe most
of
 my troubles are related to lack of knowledge.
 
 I can mount the drive just fine with the mount command. I also was
able
 to add it to the fstab and have it mount at boot.
 
 However if the drive is removed it has to be mounted again. How do you
 get it to mount back up with out having to run the mount command
again?

You'd have to use an automounter, like amd(8) that comes with FreeBSD.  
 
 Also I noticed while playing with it that the device assignment keeps
 changing each time it is plugged back into the system. Started with
 /dev/da0s1, then da1s1, then da2s1, da3s1 and so on. Which means I
have
 to change my mount comand every time.

This should not happen. The devfs filesystem that FreeBSD uses removes
device nodes if the devices are removed (unless the devices are still in
use). 

Are you unmounting the filesystem on the thumbdrive before removing the
drive from the USB port? If not this could be the cause of the
problem. Note that removing a mounted drive can crash your system!
_Always_ unmount a filesystem _before_ removing the device it is on.

[As an aside, FreeBSD's disk device drivers and filesystems predate
hot
removeable devices by a considerable margin; they were written with the
(implicit) assumption that disk devices are not removed while the system
is running. Although work has been done in DragonflyBSD (a derivative of
FreeBSD 4) to fix this, those changes haven't made it into FreeBSD
6/7.x.]

If you have device nodes for devices that aren't there anymore, you can
try running 'camcontrol rescan all' as root.

If the filesystem on the thumbdrive has a label FOO, you should see that
label as a device node in /dev/msdosfs/FOO (for FAT* filesystems) or
/dev/ufs/FOO (for UFS formatted drives). Unlike the da devices this
doesn't depend on the sequence in which devices are plugged in. Labels
can be made with tunefs(8) (for UFS filesystems) or newfs_msdos(8) for
msdos filesystems.

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)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Auto Mount USB

2008-08-18 Thread Roland Smith
On Mon, Aug 18, 2008 at 04:21:41PM -0400, Brian Miller wrote:
 Not a big deal. I will be sure to just mount and dismount the USB drives
 manually. They are just there to store a config and log backup on the
 firewall.

If an attacker has gained access to the system, anything mounted locally
should be deemed unreliable.

 I am doing this so that if I have a failure or attack or some
 other type of crash. I will be able to check out the latest config and
 logs.

I suppose that you know that you can use syslogd to log to another
machine? And you could use logger(1) to read config files into the log.

That would be much safer because it's a one-way street. You can log to
another machine, but you cannot delete from the logfile on the other
machine, unless it's compromised as well.

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)


pgpSCYk5XwyPW.pgp
Description: PGP signature


RE: Auto Mount USB

2008-08-18 Thread Brian Miller
I you are correct and the thought had crossed my mind. In the event of a
system failure it would be nice to have one hanging there in the system.
I might add that these systems are in locked server rooms. 

I had planned on doing over the wire backups 1 per day over our wide
area back to our main office and wanted to minimize bandwidth usage. My
thoughts were to back up the config and logs once daily over the wire
and to the USB drive every 3 hours or so.

However, I am aware that the drives have limited writes and they would
need to be replace every once and a while.

-Original Message-
From: Roland Smith [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 18, 2008 5:15 PM
To: Brian Miller
Cc: freebsd-questions@freebsd.org
Subject: Re: Auto Mount USB

On Mon, Aug 18, 2008 at 04:21:41PM -0400, Brian Miller wrote:
 Not a big deal. I will be sure to just mount and dismount the USB
drives
 manually. They are just there to store a config and log backup on the
 firewall.

If an attacker has gained access to the system, anything mounted locally
should be deemed unreliable.

 I am doing this so that if I have a failure or attack or some
 other type of crash. I will be able to check out the latest config and
 logs.

I suppose that you know that you can use syslogd to log to another
machine? And you could use logger(1) to read config files into the log.

That would be much safer because it's a one-way street. You can log to
another machine, but you cannot delete from the logfile on the other
machine, unless it's compromised as well.

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)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]