Share on Linux

Install Samba Server

sudo tasksel install samba-server

Share Home folders

Create a copy of your /etc/samba/smb.conf and then edit it using your favorite editor.

sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.bkp
sudo vi /etc/samba/smb.conf

/etc/samba/smb.conf:

[global]
   workgroup = WORKGROUP
   server string = %h server (Samba, Ubuntu)
   dns proxy = no
   log file = /var/log/samba/log.%m
   max log size = 1000
   syslog = 0
   panic action = /usr/share/samba/panic-action %d
   server role = standalone server
   passdb backend = tdbsam
   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
[printers]
   comment = All Printers
   browseable = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700
[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no
[homes]
   comment = Home Directories
   browseable = yes
   read only = no
   create mask = 0700
   directory mask = 0700
   valid users = %S

Restart samba server to apply new configuration:

sudo systemctl restart smbd

Add user(s) to Samba

Samba has its own user management but the samba users must also be users in the host (the password can and probably should be different).

Add user to samba:

sudo smbpasswd -a USERNAME

Create password for the user to access the Samba shares. The user should be able to change it later using smbpasswd on linux.

Firewall

Most likely you have ufw (firewall) enabled on your linux server. If you don’t, you probably should 🙂

You need to configure it to allow access from other computers on your local network:

sudo ufw allow from 192.168.0.0/24 to any app samba

Replace 192.168.0.0/24 if your local network.

Share and Mount on MacOS

Mount shares on Linux

sudo mount -t cifs -o username=USERNAME,domain=DOMAIN //HOST/PATH /LOCALPATH

You should be prompted for the password if one is required.

References


0 Comments

Leave a Reply

Avatar placeholder