2023为什么又要写samba,因为manjaro更新后,有些东西和过去有所不同
1.安装软件
sudo pacman -S samba gvfs-smb thunar-shares-plugin
2.因为配置起来比较麻烦,有一个自动配置软件 manjaro-settings-samba可以辅助:
sudo pacman -S manjaro-settings-samba
3.重点来了,怎么编写/etc/samba/smb.conf 配置文件。下面是一个例子,前面的部分都是自动生成的,最后一块是新增的。
sudo gedit /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
dns proxy = no
log file = /var/log/samba/%m.log
max log size = 1000
client min protocol = SMB2
server role = standalone server
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *New*UNIX*password* %n\n *ReType*new*UNIX*password* %n\n *passwd:*all*authentication*tokens*updated*successfully*
pam password change = yes
map to guest = Bad Password
usershare allow guests = yes
name resolve order = lmhosts bcast host wins
security = user
guest account = nobody
usershare path = /var/lib/samba/usershare
usershare max shares = 100
usershare owner only = yes
force create mode = 0070
force directory mode = 0070
load printers = no
printing = bsd
printcap name = /dev/null
disable spoolss = yes
show add printer wizard = no
[homes]
comment = Home Directories
browseable = no
read only = yes
create mask = 0700
directory mask = 0700
valid users = %S
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
#[m_sharee]部分为新增加部分,原配置中没有
[m_sharee]
comment = MShare Directories
path = /home/franksun
writeable = yes
create mask = 0700
directory mask = 0700
×××××××××××××××××[m_sharee]部分为新增加部分,原配置中没有××××××××××××××××××××××
read only 属性设置为no 是为了有写入文件权限
添加分享用户并设置密码,franksun是我的用户名,请自行更换自己的
sudo gpasswd sambashare -a franksun
sudo smbpasswd -a franksun
如果是用virtual或vmware虚拟机 记得改桥接网卡,不然用不了!!
启用smaba 服务
sudo systemctl enable smb nmb
sudo systemctl start smb nmb
sudo systemctl status smb nmb
udo systemctl restart smb nmb