Skip to content

Instantly share code, notes, and snippets.

@Xantios
Last active August 30, 2020 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xantios/d4ed55b753b49003ac87c3ba8a557a49 to your computer and use it in GitHub Desktop.
Save Xantios/d4ed55b753b49003ac87c3ba8a557a49 to your computer and use it in GitHub Desktop.
Samba Server stuff

Why?!

I cant remember how Samba configs work because the syntax is just plain stupid to me. Also, mostly set it up when i replace my server.

I want it to integrate propperly with my Mac and be usable over a VPN.

Samba

As being said, i want to see my homedir, so lets install samba

# apt install tasksel
# tasksel install samba-server
# smbpasswd -a xantios
[global]

   # Samba likes CAPS, I dont. 
   # Seems to be something with NETBIOS Legacy
   multicast dns register = no
   
   # Workgroup, can be anything.
   workgroup = Sacredheart
   
   # Feel free to be creative here
   server string = %h server (Samba, Ubuntu)
   
   # Log some stuff
   log file = /var/log/samba/log.%m
   max log size = 1000
   logging = file
   
   # Default stuff
   panic action = /usr/share/samba/panic-action %d
   server role = standalone server
   obey pam restrictions = yes
   unix password sync = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
   pam password change = yes
   map to guest = bad user
   usershare allow guests = yes

# Not sure if this is secure in any way... 
# On the other hand, this is Samba. so i assume everything is unsecure.
[homes]
   comment = Home Directories
   browseable = yes
   read only = no
   create mask = 0700
   directory mask = 0700
   valid users = %S

Avahi

So the new samba server pops up in the finder

apt install avahi-daemon

My Avahi config /etc/avahi/avahi-daemon.conf


[server]
host-name=Kelso
#domain-name=local
#browse-domains=0pointer.de, zeroconf.org
use-ipv4=yes
use-ipv6=no
#allow-interfaces=eth0
#deny-interfaces=eth1
#check-response-ttl=no
#use-iff-running=no
#enable-dbus=yes
#disallow-other-stacks=no
#allow-point-to-point=no
#cache-entries-max=4096
#clients-max=4096
#objects-per-client-max=1024
#entries-per-entry-group-max=32
ratelimit-interval-usec=1000000
ratelimit-burst=1000

[wide-area]
enable-wide-area=yes

[publish]
#disable-publishing=no
#disable-user-service-publishing=no
#add-service-cookie=no
#publish-addresses=yes
publish-hinfo=no
publish-workstation=no
#publish-domain=yes
#publish-dns-servers=192.168.50.1, 192.168.50.2
#publish-resolv-conf-dns-servers=yes
#publish-aaaa-on-ipv4=yes
#publish-a-on-ipv6=no

[reflector]
#enable-reflector=no
#reflect-ipv=no

[rlimits]
#rlimit-as=
#rlimit-core=0
#rlimit-data=8388608
#rlimit-fsize=0
#rlimit-nofile=768
#rlimit-stack=8388608
#rlimit-nproc=3

and for the samba config... Also, set a fancy icon! because we can!

/etc/avahi/services/samba.service

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
    <name replace-wildcards="yes">%h</name>
    <service>
        <type>_smb._tcp</type>
        <port>445</port>
    </service>
    <service>
        <type>_device-info._tcp</type>
        <port>0</port>
        <txt-record>model=Xserve</txt-record>
    </service>
</service-group>
@Xantios
Copy link
Author

Xantios commented Aug 30, 2020

Update: Tested this on Fedora 32 and that seems to work to! :-) (replace apt with dnf obviously)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment