Installing and configuring Samba
The Samba service helps make Linux file-sharing services compatible with Microsoft Windows systems. We can install it on our Debian/Ubuntu server with this command:
$ sudo apt-get install samba samba-common-bin
The samba package installs the file-sharing services. The samba-common-bin package might be needed in order to have the smbpasswd tool available. Users that are allowed to access the shared files need to be registered with it. We will register our odoo user, and set a password for it:
$ sudo smbpasswd -a odoo
After this, we will be asked for a password to use to access the shared directory, and the odoo user will be able to access shared files for its home directory, although it will be read-only. We want to have write access, so we need to edit the Samba configuration file to change it, as follows:
$ sudo nano /etc/samba/smb.conf
In the configuration file, look for the [homes] section. Edit its configuration lines so that they match these settings:
[homes] comment = Home Directories browseable = yes read only = no create mask = 0640 directory mask = 0750
For the configuration changes to take effect, restart the service:
$ sudo /etc/init.d/smbd restart
On Windows, we can now access the network shared files with File Explorer, using a \\<my-server-name-or-IP> address. In our example, we used \\odoo or \\192.168.56.101.
When accessing for the first time, we will be asked for the Samba login created just now. Following our example, use the odoo user with the chosen password. You might encounter trouble with Windows adding the computer's domain to the username (for example, MYPC\odoo). To avoid this, use an empty domain by prepending a \ character to the login (for example, \odoo).
After this, we will be able to access and edit the contents of the odoo user's home directory:
This is more comfortable to use, and persistent across Windows reboots, mapping a network drive for the path \\<my-server-name>\odoo.