欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 教育 > 锐评 > 【ubuntu 】使用samba配置共享用户home目录和其他具体路径

【ubuntu 】使用samba配置共享用户home目录和其他具体路径

2025/11/1 12:07:54 来源:https://blog.csdn.net/wss794/article/details/140016332  浏览:    关键词:【ubuntu 】使用samba配置共享用户home目录和其他具体路径

目录

1 安装samba

2 修改Samba配置文件

3 增加Rose用户的samba帐号

4 重启samba

5 测试


1 安装samba

使用如下命令安装samba

sudo apt-get updatesudo apt-get install samba openssh-server

2 修改Samba配置文件

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.ba# 打开文件sudo vim /etc/samba/smb.conf
  • 修改 ①

文件中的[homes]项内容默认是注释掉的,我们取消注释,修改成如下:

#======================= 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 Directoriesbrowseable = no# 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 = yes# 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 schemesvalid users = %S
  • 修改 ② 

说明:用于指定共享的具体路径

在文件的末尾,追加如下内容:

[test]comment = Shared smb_basepath = /home/test/create mask = 0755directory mask = 0755writable = yesvalid users = Rosebrowseable = yes

如上修改完成后wq保存退出!

3 增加Rose用户的samba帐号

Rose为用户名,给Rose开通samba帐号的命令如下:

sudo smbpasswd -a Rose

然后根据提示设置对应的密码即可。

4 重启samba

sudo service smbd restart && service nmbd restart

5 测试

Windows下输入samba地址尝试登录:

示例如下:

\\你要连接的电脑的IP地址\test

然后,输入用户名Rose和对应的密码就可以访问共享的文件夹了。。。

至此,本文分享的内容就结束啦!遇见便是缘,感恩遇见 !!!💛 💙 💜 ❤️ 💚 💛 💙 💜 ❤️ 💚

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词