Hi everyone!! I am NOT Topher Grace, nor do I want to be. I am just Topher Scribbles and just for kicks, I really want to out-rank Topher Grace's IMDB website. If you want to help, just link to me. Thanks and enjoy some boring fun!!

Go to http://www.dnsyard.com for some free DNS tools.

FreeBSD Samba

So you want to mount a network drive with Samba?

First thing you do is install Samba via ports on both systems. (Be sure to update your ports with cvsup, that will be in a future article)

# cd /usr/ports/net/samba3
# make install clean

Next, on the server machine, in order to make Samba run, you will need to add it to /etc/rc.conf. Just add this line:

samba_enable="YES"

On the client machine, you don’t have to start Samba. In fact, for added security, I remove the samba.sh startup script like so:

# rm /usr/local/etc/rc.d/samba.sh

Now we add the user on the server machine. You will be adding an actual Unix user, but without a login and home directory.

# adduser SambaUser

Username : SambaUser
Password : *****
Full Name : Samba User
Uid : 1004
Class :
Groups : SambaUser
Home : /dev/null
Shell : /usr/sbin/nologin
Locked : no

Add a Samba password:

smbpasswd -a SambaUser

Now we edit the Samba service in smb.conf located at /usr/local/etc/smb.conf with…

[SambaUserdir]
comment = SambaUser's Network Drive
path = /path/to/directory
valid users = SambaUser
public = no
writeable = yes
printable = no

Be sure to create the directory (/path/to/directory) and make that writable to the SambaUser.

To test your server, you should be able to do this:

# smbclient -L 127.0.0.1 -U SambaUser

If no errors, then you are good to go. If you get an error, please refer to Samba’s site, or you can google the error message.

We can start Samba now with this:

# /usr/local/etc/rc.d/samba.sh start

Now we mount the drive. Create the directory in the client machine where you would like the mounted network drive at, and then mount it. (NOTE: Below is all one line)

mount_smbfs -I 192.168.0.2 //SambaUser@ServerName/SambaUserdir /path/to/mount

That’s pretty much it!!

Done!!

Post a Comment

You must be logged in to post a comment.