Samba

From Andreida
Revision as of 11:47, 16 February 2016 by Andreas (talk | contribs) (Created page with "== samba via nfs == if you get the drive via nfs, use the following at the exporting server: addgroup --gid 200 sambashare and change the group id of sambashare at the samba...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

samba via nfs

if you get the drive via nfs, use the following at the exporting server:

 addgroup --gid 200 sambashare

and change the group id of sambashare at the samba server to the same as above. If you need to change files (because they belong to the old group):

find . -name "*" -gid #OLD -exec chgrp #NEW {} \;

Source: http://cgi.zdnet.de/forum/viewtopic.php?t=533

I had to change my nfs mount to

192.168.0.1:/mnt/samba-root/samba /mnt/samba nfs nolock,rw,addr=192.168.0.1 0 0

to be able to use it. The samba-root/samba is done that way, so we have a root which is writable by the group sambashare. nolock is needed so we can write at all. It is not needed, if you just use the nfs directly !

You have to make sure, that the exported directoy - samba in the above case - is owned and readable and writeable by the group sambashare.

Server

add the users which will be allowed samba access:

adduser user1
adduser user2

Install samba:

apt-get install samba
apt-get install samba dbus-x11 cups-common rng-tools gnutls-bin libsasl2-modules-otp libsasl2-modules-ldap  openbsd-inetd smbldap-tools ldb-tools ctdb

enter workgroup name

create a new smb.conf from smb.conf.master

testparm -s smb.conf.master >smb.conf

data for /etc/samba/smb.conf

[global]
        hosts deny = ALL
        hosts allow = 192.168.0.1 192.168.0.2
        workgroup = YOURNETWORK
        server string = %h server
        obey pam restrictions = Yes
        pam password change = Yes
        passwd program = /usr/bin/passwd %u
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        unix password sync = Yes
        syslog = 0
        log file = /var/log/samba/log.%m
        max log size = 1000
        printcap name = /etc/printcap
        dns proxy = No
        panic action = /usr/share/samba/panic-action %d

[printers]
        comment = All Printers
        path = /var/spool/samba
        create mask = 0700
        printable = Yes
        browseable = No

[print$]
        comment = Printer Drivers
        path = /var/lib/samba/printers

[samba]
        comment = This is a test
        path = /mnt/samba
        valid users = yourUser
        force group = sambashare
        read only = No
        create mask = 0775
        directory mask = 0775

add the users to the samba db:

smbpasswd -a user1
smbpasswd -a user2

restart the samba service:

/etc/init.d/samba restart

Errors

Unable to connect to CUPS server localhost:631 - Connection refused

add to [global]

printcap name = /etc/printcap