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

目录

[1 安装samba](#1 安装samba)

[2 修改Samba配置文件](#2 修改Samba配置文件)

[3 增加Rose用户的samba帐号](#3 增加Rose用户的samba帐号)

[4 重启samba](#4 重启samba)

[5 测试](#5 测试)


1 安装samba

使用如下命令安装samba

sudo apt-get update

sudo 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 Directories

   browseable = 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 schemes

   valid users = %S
  • 修改 ②

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

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

[test]

   comment = Shared smb_base

   path = /home/test/

   create mask = 0755

   directory mask = 0755

   writable = yes

   valid users = Rose

   browseable = yes

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

3 增加Rose用户的samba帐号

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

bash 复制代码
sudo smbpasswd -a Rose

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

4 重启samba

bash 复制代码
sudo service smbd restart && service nmbd restart

5 测试

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

示例如下:

bash 复制代码
\\你要连接的电脑的IP地址\test

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

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

相关推荐
口嗨农民工3 小时前
uboo对内存操作读写命令的基本使用
linux·ubuntu·c·uboot
啞謎专家4 小时前
Ubuntu 22.04 LTS 上安装 MySQL8.0.23(在线安装)
linux·运维·ubuntu
分享者花花5 小时前
数据恢复篇:5 款最佳 Mac 数据恢复软件
windows·macos·ios·智能手机·电脑·笔记本电脑·iphone
孫治AllenSun5 小时前
【List】判断集合相等、集合拷贝
windows·python·list
白如意i5 小时前
在Ubuntu 16.04上安装和配置OpenLDAP和phpLDAPadmin的方法
linux·运维·ubuntu
濃nong5 小时前
使用U盘重装系统
windows
cong*5 小时前
cpu,缓存,辅存,主存之间的关系及特点
网络·windows·经验分享·笔记·其他·缓存·计算机外设
发光的小豆芽15 小时前
Windows下Visual Studio 中配置第一个CUDA工程
ide·windows·visual studio
syluxhch16 小时前
Windows快速打开某个路径下的PowerShell
windows·microsoft
系统之家装机大师16 小时前
一键获取:Win11笔记本系统下载地址!
windows·电脑