Skip to content

Instantly share code, notes, and snippets.

@bitdruid
Created June 20, 2024 19:50
Show Gist options
  • Save bitdruid/cd77b83cd5d1435a561ae81a9b9f7132 to your computer and use it in GitHub Desktop.
Save bitdruid/cd77b83cd5d1435a561ae81a9b9f7132 to your computer and use it in GitHub Desktop.
Simple samba installation for raspberry pi for fast file exchange e.g. after a new installation. Configures /home/pi/samba as a samba share.
#!bin/bash
# install samba
sudo apt -qq update && sudo apt -qq install -y samba
sudo systemctl enable --now smbd nmbd
# create samba share directory
mkdir -p /home/pi/samba
# create samba user
(echo ""; echo "") | sudo smbpasswd -a pi
# configure samba
config="
[global]
workgroup = WORKGROUP
dns proxy = no
map to guest = Bad User
guest account = pi
null passwords = yes
[samba]
path = /home/pi/samba
browseable = yes
writeable = yes
read only = no
guest ok = yes
create mask = 0777
directory mask = 0777
force user = pi
force group = pi
"
printf "%b" "$config" | sudo tee /etc/samba/smb.conf
# finally, restart
sudo systemctl restart smbd nmbd
# connect via smb://<ip>/samba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment