Ubuntu 16.04 TLS Samba配置

来源:互联网 发布:神经网络算法能做什么 编辑:程序博客网 时间:2024/05/17 03:00

简介

本文介绍了如何在Ubuntu 16.04 TLS系统上配置Samba,并在Windows系统中将共享目录作为指定驱动器挂。

Samba安装

Samba的安装非常简单,仅需要执行下面的命令即可:
hadoop@hadoop-virtualbox:~$ sudo apt-get install samba

Samba配置

Samba的配置为 /etc/samba/smb.conf,该配置文件对各配置项的使用均有详细的描述,用户可以根据自己的需要进行定制。这里介绍涉及配置仅用户访问自己的home目录的配置修改:

#======================= Share Definitions =======================# Un-comment the following (and tweak the other settings below to suit)# to enable the default home directory shares. This will share each# user's home directory as \\server\username[homes]   comment = Home Directories   browseable = yes# By default, the home directories are exported read-only. Change the# next parameter to 'no' if you want to be able to write to them.   read only = no# File creation mask is set to 0700 for security reasons. If you want to# create files with group=rw permissions, set next parameter to 0775.   create mask = 0700# Directory creation mask is set to 0700 for security reasons. If you want to# create dirs. with group=rw permissions, set next parameter to 0775.   directory mask = 0700# By default, \\server\username shares can be connected to by anyone# with access to the samba server.# Un-comment the following parameter to make sure that only "username"# can connect to \\server\username# This might need tweaking when using external authentication schemes   valid users = %S
这里需要将注释;部分去除掉,具体权限的配置可以参考配置文件的说明。修改配置文件之后,需要重启Samba服务,并为用户配置访问密码:
hadoop@hadoop-virtualbox:~$ sudo /etc/init.d/samba restart[ ok ] Restarting nmbd (via systemctl): nmbd.service.[ ok ] Restarting smbd (via systemctl): smbd.service.[ ok ] Restarting samba-ad-dc (via systemctl): samba-ad-dc.service.hadoop@hadoop-virtualbox:~$ sudo smbpasswd -a hadoopNew SMB password:Retype new SMB password:hadoop@hadoop-virtualbox:~$ 

Windows挂载网络驱动器

登录Windows,右键点击“计算机”,选择“映射网络驱动器”,为链接到的连接和文件夹指定网络驱动器,文件夹选项为用户的Home目录,点击“完成”后,根据提示输入Samba的访问密码即可。
到这里,整个配置就完成了,用户可以在Windows系统中访问Ubuntu共享的目录。

原创粉丝点击