This page gathers information concerning the configuration of Samba on Unix hosts.
Samba is operational on most Unix flavours. It helps share drives and printers
with Windows hosts.
Those notes are for Debian / Ubuntu only.
Those notes are for Solaris / OpenSolaris only.
OS | Packages | Services | Default location for smb.conf |
---|---|---|---|
Debian | samba, smbclient | /etc/init.d/samba start | |
Solaris | installed by default | /etc/sfw/smb.conf | |
OpenSolaris / OpenIndiana | installed by default | svc:/network/samba:default svc:/network/winbind:default svc:/network/wins:default svc:/network/swat:default |
Configuration file
Sample configuration file
[global] server string = Boureautic Samba Server security = SHARE log file = /var/samba/log/log.%m max log size = 50 dns proxy = No read only = No hosts allow = 192.168.0., 127. [homes] comment = Home Directories browseable = No [sauvegardes] comment = Repertoires de sauvegardes sur Boureautic path = /mnt/win_e/sauvegardes guest ok = Yes
See where Samba reads its configuration file from
smbd -b | grep conf
Solaris 10:
smbd is located in /usr/sfw/bin.
smbd is located in /usr/sfw/bin.
Share a mount point without any password
To share a mount point with a host running Windows without any password:[share] ... guest ok = Yes ... [global] read only = No security = SHAREOf course, this is insecure !
User security settings
If user per-user security settings, you must first set passwords using smbpasswd:
smbpasswd -a -U <username>
smbpasswd is located in /usr/sfw/bin for Solaris 10.
Validate smb.conf
To test your smb.conf file, use testparm <smb.conf file>.
Solaris 10:
testparm is located in /usr/sfw/bin.
testparm is located in /usr/sfw/bin.
smbclient
- Find out what shares are available on a given host:
smbclient -L hostname -I <IP address>
- access a given share:
smbclient //hostsname/share -U username -I <IP address>
orsmbclient \\\\hostname\\sharename -U username
smbclient --no-pass -L IPAddress Domain=[WORKGROUP] OS=[Apple Base Station] Server=[CIFS 4.32]
On OpenIndiana:
smbutil view "//WORKGROUP;username@IPaddress" Password: Share Type Comment ------------------------------- IPC$ IPC Data disk 2 shares listed from 2 availableThe workgroup can be an IP address.
smbfs
To mount a share as a filesystem:
On Linux,
mount -t cifs [--verbose] -o user="WORKGROUP/Username%password",sec=ntlm //host/share /mnt/point
On OpenSolaris,
modload -p drv/nsmb modload -p fs/smbfs devfsadm -i nsmb pfexec mount -f smbfs //server/share /mntpoint Password:To mount an Apple TimeCapsule for instance:
pfexec mount -F smbfs -o fileperms=0777,dirperms=0777 "//WORKGROUP;User:password@host/share" /mntpointThe corresponding line can be added to /etc/vfstab to automate the mounting.
//WORKGROUP;User:password@host/share - /mntpoint smbfs - no fileperms=0777,dirperms=0777and then to mount:
pfexec mount /mnt/timecapsule
SWAT
To disable SWAT on Debian:
- disable localhost:901, in/etc/inetd.conf
- then kill -1 inetd to restart.
To disable SWAT on OpenSolaris: stop the svc:/network/swat:default service :
svcadm disable svc:/network/swat:default
RPC
net rpc shutdown -I ipAddressOfWindowsPC -U username%password net rpc shutdown -r : reboot the Windows machine net rpc abortshutdown : abort shutdown of the Windows machineSee prefetch blog