====== Samba Setup ==
===== Expose one shared dir ==
Tested setup on Slack 12.2.
First create a [[http://us5.samba.org/samba/docs/man/Samba-HOWTO-Collection/install.html#id2553100|simple Samba configuration file]] ''/etc/samba/smb.conf'':
[global]
workgroup = testgroup
follow symlinks = no
[mytest]
path = /smb
read only = no
guest ok = no
Test Your Config File, create a directory for the [mytest] samba share above, start samba server and check if server responds (all as root):
testparm /etc/samba/smb.conf # test config file
mkdir /smb # create samba share
chmod 777 /smb
chomd +x /etc/rc.d/rc.samba # start server
/etc/rc.d/rc.samba start
smbclient -U% -L localhost # check (just press return at password promt)
Enable access for a normal user (eg "sandy"). Note that the user must already have a normal login on the machine (''adduser sandy'').
smbpasswd -a sandy
Check if samba share is accessable as normal user sandy on the server:
smbclient //localhost/mytest
Check if samba share is accessable as normal user sandy on a windows client:
M:\>net use j: \\etb-111\mytest
Other documentation: [[http://us5.samba.org/samba/docs/using_samba/toc.html|Using Samba, 2nd Edition]], [[http://us5.samba.org/samba/docs/man/Samba-Guide/|Samba-3 by Example]], [[http://us5.samba.org/samba/docs/man/manpages-3/|Samba man pages]]
===== Expose home dirs per user ==
[global]
workgroup = testgroup
follow symlinks = no
[user]
path = /home/%U
read only = no
M:\>net use j: \\etb-111\user
Username: sandy
Password: ***
''%U'' was found [[http://us5.samba.org/samba/docs/man/Samba-Guide/simple.html#AccountingOffice|here]]
===== Set file mode creation mask ==
As default a remote Win client creates a file on the server ''744 = rwxr--r--''. The mask can be [[http://us5.samba.org/samba/docs/man/manpages-3/smb.conf.5.html#CREATEMASK|changed]] with in ''smb.conf'' to e.g. the linux default ''644 = rw-r--r--'':
[global]
create mask = 0644
===== List Users in Smb Database ==
pdbedit -L [-v]
===== Import User Accounts from other Smb Server ==
Just copy ''/etc/samba/private/passdb.tdb'' form old server to new server. This doesn't work any more. They user account/password file is now at ''/var/lib/samba/private''
Because the new location of the password file is obviously not mentioned in man pages of pdbedit and smbpasswd i suppose it is not meant to simply copy it over. Instead on the old server we export all samba users to a textfile and import that file into the new samba server:
# On old server:
pdbedit -e smbpasswd:smbusers.txt
# Now copy smbusers.txt to new server and on the new server:
pdbedit -i smbpasswd:smbusers.txt