Network: Samba: How-To START HERE!!!

(last edit: 2002-05-14) How to start First of all start with the obvious: install samba. You can find samba in the dir: /usr/ports/net/samba The following dir's are important after the installation: /usr/local/sbin /usr/local/etc The samba deamons 'smbd' and 'nmbd' will be in the 'sbin' dir and the configuration file(s) will be in the 'etc' dir. There will be a sample configuration file in the 'etc' dir but I advise you to make your own from scratch. You'll see that this is easier than altering the sample file. Configuration file To create your own 'smb.conf' file see Simple configuration or Advanced configuration. When you're finished with building your own configuration file(s) run 'testparm' to see if the file is correct. Users Although you probaly forgot: windows does have users. When windows starts, you log in as a known user. If this users must be able to connect to the samba shares then this user MUST exist on your FreeBSD machine. So basicly the windows user must have an account on your FreeBSD machine and it is handy to set the samba password to the windows password. Set the shell to 'nologin' and the homedir to 'nonexistent' if you don't want the users to actually be able to login to your FreeBSD machine via telnet/ssh etc. You can add users with the 'adduser' script (just type 'adduser' at the prompt), remove them with 'rmuser' and edit them with 'vipw'. You must be root to execute this commands. man vipw Vipw edits the password file after setting the appropriate locks, and does any necessary processing after the password file is unlocked. If the password file is already locked for editing by another user, vipw will ask you to try again later. The default editor for vipw is vi(1). E.g. change : jappe:[encrypted password]:1000:50::0:0:jappe reuling:/home/jappe:/usr/local/bin/zsh in: jappe:[encrypted password]:1000:50::0:0:jappe reuling:/nonexistent:/sbin/nologin If the user does exist on the FreeBSD machine you'll have to give them access to samba by typing the following as root: $smbpasswd -a [username] This will ask you for a password and will add this password to the samba password file. See FreeBSD commands for some more info about 'smbpasswd'. Don't edit the samba password file yourself!! Just use 'smbpasswd'. Finaly You have to make sure that 'smbd' and 'nmbd' are running. They live in /usr/local/sbin. You can start them by typing: /usr/local/sbin]./smbd -D /usr/local/sbin]./nmbd -D The '-D' option makes sure they start as deamon and thus in the background. There is a default start-up script in the '/usr/local/etc/rc.d' directory named ''. Copy this file to '' (in the same dir) and smbd and nmbd will be started when you boot your computer. This is how the '' file looks like: ------ #!/bin/sh smbspool=/var/spool/samba pidfiledir=/var/run smbd=/usr/local/sbin/smbd nmbd=/usr/local/sbin/nmbd # start if [ "x$1" = "x" -o "x$1" = "xstart" ]; then if [ -f $smbd ]; then if [ -d $smbspool ]; then rm -f $smbspool/* fi echo -n ' Samba' $smbd -D $nmbd -D fi # stop elif [ "x$1" = "xstop" ]; then kill `cat $pidfiledir/` kill `cat $pidfiledir/` fi ------ If you don't want to use this script then you can edit your /etc/rc.local file. Put this in the 'rc.local' file: ------- if [ -x /usr/local/sbin/smbd ] then echo echo "Starting Samba deamon" echo /usr/local/sbin/smbd -D else echo echo "Samba Deamon not found in /usr/local/sbin." echo "!!!Samba daemon not started!!!" echo fi if [ -x /usr/local/sbin/nmbd ] then echo echo "Starting NetBIOS name server" echo /usr/local/sbin/nmbd -D else echo echo "NetBIOS name server not found in /usr/local/sbin." echo "!!!NetBIOS name server not started!!!" echo fi ------- Trouble If things doesn't work as they are supposed to: see the log files (duh?) No realy they can help you allot. These log files are (if you haven't changed the location/names in the config files) in the dir '/var/log'. There will be a 'nmbd.log' and a 'smbd.log'.

Click here to go back to the index.