Skip to content

Ubuntu安装Samba服务

alt text

sudo apt update
sudo apt install samba samba-common-bin -y

# 添加 Samba 用户并设置密码,用户需为系统已存在用户
sudo smbpasswd -a your_username

# 允许 Samba 通过防火墙
sudo ufw allow samba

sudo vim /etc/samba/smb.conf

[nas]
comment = nas
path = /mnt/data1/nas
browseable = yes
read only = no
writable = yes
create mask = 0664
directory mask = 0775
valid users = root
guest ok = yes
force user = root


# 测试配置文件语法
sudo testparm

# 重启服务生效
sudo systemctl restart smbd nmbd