Mount SMB share on bootup

Edward Epstein peepstein at canada.com
Fri Nov 14 17:17:23 PST 2003


Lines prefixed with ">" are what C. Ulrich wrote.

>On Mon, 2003-11-10 at 15:21, Chirhart, Brian wrote:
>> >> point is password protected (on the XP side) so I am prompted for a
>> >> password.  How can I automate that?  Or should I create the share
>> >> without
>>
>> a
>>
>> >> password?  I am not too worried about internal security so the share
>>
>> could
>>
>> >> have no password and that would be fine.
>> >
>> >Create a script called whatever.sh, chmod +x 755 whatever.sh and put that
>> >script in a /usr/local/etc/rc.d.
>> >
>> >Put the following lines in that script
>> >
>> >#!/bin/sh
>> >smbmount username=user password=pass and the rest of the parametars that
>>
>> you
>>
>> >are normaly using when mounting smb partition.
>> >
>> >Mind that if your startup script for samba is samba.sh your mounting
>> > script must start with a letter after the letter s otherwise you would
>> > mounting a samba share without smb daemon started.
>>
>> ################################
>>
>> When I try the smbmount I get a "command not Found"
>>
>> I checked the man pages on mount and found mount_smbfs, but I can not find
>> any options that would allow me to specify a username and password.
>>
>> I am not using Samba (at least I didn't load it... may be there by
>> default???) - To map the drive I have a line in my /etc/fstab file that
>> reads:
>>
>> # Device			#Mountpoint	FSType	OPtion
>> //user at server/share	/ftproot	smbfs	rw.nosuto	0	0
>>
>> Once the server boots, I type "mount /ftproot" and then it asks me for the
>> password for User.  After the password is entered, /ftproot contains the
>> contents of the share on my XP system.  It was one of the things that I
>> fell in love with about BSD - the ability to "see" XP shares with no
>> special "magic".
>>
>> So anyway - I think there are several different approaches to this.  Can I
>> modify my fstab file so that "auto" would work by somehow specifing a
>> password?  Or is there a password option that I am missing in the mount or
>> mount_smbfs commands?  OR...  is there a reason I don't have the smbmount
>> command?
>>
>> Thank you for all your help!
>
>I saw that you got a couple responses to this, but they were just a bit
>off from the "correct" way to do it. Edward came very close, so I'm just
>going to expand upon what he said. First, If I recall correctly, the
>smbfs.sh that goes in /usr/local/etc/rc.d was somehow accidentally left
>out of the release. If you don't have it, you can get it here:
>
>http://www.freebsd.org/cgi/cvsweb.cgi/src/contrib/smbfs/examples/smbfs.sh.sa
>mple
>
>Click on the "Download" link for the newest version. It's probably
>better to use this version instead of a home-made one so that you don't
>run into problems down the road. (Don't forget to nuke the "sample"
>extension.)

It never even occured to me to parse fstab to get a list of mountpoints and 
then just do them all automatically. If you've got lots of Samba shares, it 
comes in really handy.

>Your /etc/fstab is fine, but you should move /etc/nsmb.conf to
>/root/.nsmbrc. If you consult mount_smbfs(8), you'll see that this is
>where mount_smbfs expects it to be. Plus, keeping it here affords you a
>little bit better security. (Double-check that it's readable/writable by
>root ONLY!)

When I was setting up my share, I tried putting .nsmbrc in /root initially, 
but IIRC it didn't work. Now that I look at the correct rc.d script, it 
probably didn't work because $HOME wasn't set. Does that make sense?

>Finally, you should obfuscate the password with "smbutil crypt". This is
>NOT encryption, it will only protect the password from being discovered
>by casual observation. You should still treat it as plaintext, even in
>obfuscated form, as the "encryption" is almost as trivial to crack as
>rot13.

Also great info, thanks very much!

>Good luck!
>
>Charles Ulrich
>
>_______________________________________________
>freebsd-questions at freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-questions
>To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"

-- 

"There are people who cheat on their spouse but not at cards, and vice versa, 
and both and neither. Reputation is not necessarily portable from one 
situation to another, and it's not easily expressed."
--Clay Shirkey. (http://www.shirky.com/writings/group_enemy.html)

"It has been said that man is a rational animal.  All my life I have
been searching for evidence which could support this."
--Bertrand Russell.

"The American empire is ideological, not territorial. We are the most 
ideological people in the world, and we are so united in our view that we 
don't understand there can be other views."
--Lt. Gen. William Odom, ret. (Former Director of NSA).



More information about the freebsd-questions mailing list