This establishes three shares supplied by the server C142:[global] guest account = guest log file = /var/log/samba/log.%m vfs objects = audit log level = 0 vfs:2 max log size = 0 netbios name = c142 null passwords = yes printing = lprng workgroup = RWC [ken] path = /home/ken valid users = ken writeable = yes [public] hosts allow = 127.0.0.1 192.168.1.150 hosts deny = 0.0.0.0/0 path = /home/samba/%U writeable = yes [laserjet] guest ok = yes printable = yes printer = lp writeable = no
For each user to log in, you need to create a UNIX user (using useradd) and add that user to the samba passwd file usingsmbpasswd -a userThe username and password used in the smbpasswd command must be those used to connect to the share from the client. The user's directory must be created manually.
The guest user must be added manually. And the UNIX guest user must be created before Samba will start!
Logging is to a separate file for each host, and includes audit information on file access. You must create the log directory before logging will take place.
smbclient -L yournetbiosname -U testto list shares available from your samba server.
smbmount //host/share mount-point -o username=testThe "mount-point" is an empty directory; one must be created for each user, and if a user must have more than one share mounted at a time, they will need one mount point directory for every simultaneous mount. These mount point directories should be created under each user's home directory.
After the smbmount command is executed, the share is accessible in the mount point directory. After the smbumount command is executed, the mount point directory is again empty.
In practice, it should not be necessary for a UNIX user to mount their own home directory through a private Samba share. But if they do, the mount point must not be in their home directory! Doing so results in circular file system references which can cause no end of troubles.When problems occur, it is sometimes tempting to kill the smbmount process and start over. In such a situation, the use of "kill -9" will provide you with an excellent reason not to ever do this again. smbmount is a user program which makes use of the smbfs kernel module to interact with Samba, either locally or on a remote server. It does not like to be killed, and when you use "kill-9", its messes are not cleaned up. In all likelihood you will be unable to reload the smbfs module, and you will have to reboot Linux. To avoid this,
smbclient //host/printer -U guest -c "print local.file"
Copy it into /etc/samba. Check it with testparm and start samba. Check the tail of the system log file, as well as the samba log files.
- Change the netbios name to "cnnn" (where nnn is your PC number).
- Change the workgroup to "islandn" (where n = 1, 2, 3 or 4).
- Change the private (old ken) share to correspond to a non-root user on your system.
©2008, Kenneth R. Koehler. All Rights Reserved. This document may be freely reproduced provided that this copyright notice is included.
Please send comments or suggestions to the author.