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

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.

主站蜘蛛池模板: 防城港市| 宁津县| 澄迈县| 佛坪县| 德阳市| 四会市| 铅山县| 互助| 新干县| 海兴县| 五大连池市| 泊头市| 中山市| 黄石市| 湟源县| 商都县| 长汀县| 黄大仙区| 正蓝旗| 原平市| 原平市| 江阴市| 吉水县| 祁阳县| 松滋市| 灵丘县| 汶上县| 淮北市| 班玛县| 彩票| 迁安市| 招远市| 郸城县| 桂阳县| 邢台市| 简阳市| 西峡县| 辽宁省| 齐齐哈尔市| 大同市| 自贡市|