Via Cà Matta 2 - Peschiera Borromeo (MI)
+39 02 00704272
info@synaptica.info

Linux Tips – How to – Install Samba Server on Ubuntu 22.04 desktop & server

Digital Innovation Partner

Linux Tips – How to – Install Samba Server on Ubuntu 22.04 desktop & server

Install samba server:

sudo apt install samba

backup config filee:

 sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup

create a shared folder for your user, like:

 mkdir /home//mmyshare

edit samba config file:

 nano /etc/samba/smb.conf

replace all smb.conf with this:

[global]
   workgroup = WORKGROUP
   server string = %h server (Samba, Ubuntu)
   log file = /var/log/samba/log.%m
   max log size = 1000
   logging = file
   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\supdate$
   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
[mysharename]
  comment = public anonymous access
  path = /home//mmyshare
  browsable =yes
  create mask = 0660
  directory mask = 0771
  writable = yes
  guest ok = no

restart samba:

sudo systemctl restart smbd

associarte a samba password to your systemm user:

sudo smbpasswd -a

restart samba:

sudo systemctl restart smbd

Mount your share in MS Windows via shell by create a new disk:

net use t: \\<your server ip>\mysharename /persistent:yes /user:<smbuser> <smbpassword>