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 cleanNext, 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.shNow we add the user on the server machine. You will be adding an actual Unix user, but without a login and home directory.
# adduser SambaUserUsername : 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 SambaUserNow 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 = noBe 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 SambaUserIf 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 startNow 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/mountThat’s pretty much it!!
Done!!
Post a Comment
You must be logged in to post a comment.