官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 松溪县| 武夷山市| 博野县| 武城县| 中方县| 陵水| 宿迁市| 河间市| 营山县| 成武县| 交城县| 彭泽县| 东兴市| 阜康市| 灵川县| 灯塔市| 德庆县| 昌邑市| 萝北县| 沽源县| 孝感市| 大洼县| 南汇区| 油尖旺区| 建始县| 石景山区| 基隆市| 信丰县| 大姚县| 乌海市| 宜宾市| 沙雅县| 吉安县| 普宁市| 关岭| 池州市| 沁阳市| 夏邑县| 安宁市| 屏东市| 繁峙县|