Setting up a SAMBA share on Ubuntu

While this is actually not advised to be done on any production instance, during development, on for example remote or virtual machines, it can be a lifesaver.

First we install samba

sudo apt install -y samba

After the installation completes we can add a share to our server

sudo nano /etc/samba/smb.conf

The above shows the start of the file, you can immediately go all the way to the bottom for us to add an entry.

Use the below to configure yours quick, so make sure its behind a firewall, or not connected directly to the internet.



And copy paste the below in your smb.conf file.

[www]
  path = /var/www
  browsable = yes
  writable = yes
  read only = no
  force user = Your_Username
  guest ok = yes
  guest only = yes
  public = yes

After adding the above, or something alike. You can save and close (CTRL+o, CTRL+x) nano. After that we only restart the samba service, and the share will be available.

sudo service smbd restart

In Windows you will be asked for your server’s username and password, so the advice is to Map Network Drive from the context menu once you access the server (\\[IP_ADDRESS]) and then right clicking the share just created.

And another thing done, access your files on your network directly and develop something beautiful!


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *