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

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.

主站蜘蛛池模板: 叶城县| 贺兰县| 大邑县| 万安县| 四川省| 莱西市| 定兴县| 南木林县| 奉节县| 厦门市| 拉萨市| 黎川县| 土默特左旗| 凉城县| 罗平县| 济宁市| 顺义区| 巴中市| 昌平区| 伊春市| 郁南县| 忻州市| 全椒县| 桐城市| 洛隆县| 江北区| 名山县| 澄城县| 会宁县| 手机| 平定县| 武汉市| 临高县| 宣恩县| 冕宁县| 尼勒克县| 阿巴嘎旗| 太康县| 东台市| 城步| 菏泽市|