使用Samba共享Ubuntu Home目录

时间:2020-01-09 10:45:26  来源:igfitidea点击:

Samba服务器允许我们自动共享用户的主目录。这很有用,因此我们不必为每个用户手动创建每个共享。

首先,请确保已安装Samba服务器。

要共享主目录,请使用以下命令打开smb.conf:

sudo gedit /etc/samba/smb.conf

查找文件的此部分,并使其与以下内容匹配:

#======================= 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, \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

valid users = %S
# By default, the home directories are exported read-only. Change next

# parameter to ‘yes' if you want to be able to write to them.

writable = yes

现在,我们应该可以使用以下共享格式在Windows上映射驱动器:

\ubuntumachine\username

例如,如果Ubuntu计算机名为ubuntuserv,用户名为data,则共享路径将为\ ubuntuserv \ data