Skip to content

Instantly share code, notes, and snippets.

@jfdesrochers
Forked from bcchenbc/SambaDC_on_RaspberryPi3.sh
Last active March 28, 2018 02:59
Show Gist options
  • Save jfdesrochers/1d0a0323a96a976edb852f30e012aef4 to your computer and use it in GitHub Desktop.
Save jfdesrochers/1d0a0323a96a976edb852f30e012aef4 to your computer and use it in GitHub Desktop.
# Commands for setting up Samba 4 Domain Controller on Raspberry Pi 3.
# Only tested on "2017-08-16-raspbian-stretch-lite".
# Credit goes to:
# VirtualFrontiers.co.uk http://www.virtualfrontiers.co.uk/domain_controller.htm
# Techmint.com https://www.tecmint.com/set-add-static-ip-address-in-linux/
# Note that I have applied this fix for ethernet interface naming.
# https://raspberrypi.stackexchange.com/questions/43560/raspberry-pi-3-eth0-wrongfully-named-enx
# Assuming:
# router is at 192.168.1.1
# hostname is "sambadc"
# sambadc to have IP address 192.168.1.10
# domain to be named "domain.name.net"
sudo nano /etc/dhcpcd.conf
```
interface eth0
static routers=192.168.1.1
static domain_name_servers=127.0.0.1
static domain_name_servers=192.168.1.1
static ip_address=192.168.1.10
static domain_search=domain.name.net
```
sudo apt-get install samba smbclient winbind krb5-user krb5-config krb5-locales winbind libpam-winbind libnss-winbind
# Default Kerberos realm: DOMAIN.NAME.NET
# Kerberos servers: domain.name.net
# Administrative server: domain.name.net
sudo systemctl stop samba-ad-dc.service smbd.service nmbd.service winbind.service
sudo systemctl disable samba-ad-dc.service smbd.service nmbd.service winbind.service
smbd -b | grep "CONFIGFILE"
sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.backup
# sudo rm /etc/krb5.conf
sudo samba-tool domain provision --use-rfc2307 --interactive
sudo mv /etc/krb5.conf /etc/krb5.conf.backup
sudo ln -sf /var/lib/samba/private/krb5.conf /etc/krb5.conf
sudo systemctl unmask samba-ad-dc.service
sudo systemctl start samba-ad-dc.service
sudo systemctl status samba-ad-dc.service
sudo systemctl enable samba-ad-dc.service
sudo netstat -tulpn | egrep 'smbd|samba'
sudo nano /etc/resolv.conf
```
search domain.name.net
nameserver 192.168.1.10
nameserver 192.168.1.1
```
sudo chattr +i /etc/resolv.conf
sudo reboot now
ping -c3 domain.name.net
ping -c3 sambadc.domain.name.net
ping -c3 sambadc
host -t A domain.name.net
host -t A sambadc.domain.name.net
host -t SRV _kerberos._udp.domain.name.net
host -t SRV _ldap._tcp.domain.name.net
kinit administrator@DOMAIN.NAME.NET
klist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment