Ubuntu 20.04.1 共享samba给windows 10

通过ssh登录ubuntu,修改/etc/下的smb配置文件,

uidq4932@hzh57415u:/work$ cat /etc/samba/smb.conf
[global]
security = ads
realm = V01.NET
workgroup = V01
idmap uid = 10000-20000
idmap gid = 10000-20000
winbind enum users = yes
winbind enum group = yes
template homedir = /home/%D/%U
template shell = /bin/bash
client use spnego = yes
client ntlmv2 auth = yes
encrypt passwords = yes
winbind use default domain = yes
restrict anonymous = 2
kerberos method = secrets and keytab
winbind refresh tickets = true
[work]
comment = VDI_SHARE_DIR
path = /work
browseable = yes
create mask = 0777
valid users = uidq4932
available = yes
writeable = yes
read only = no
public = no

修改完成后使用命令检查下配置testparm -v /etc/samba/smb.conf

service --status-all    查看smbd是否有运行,
systemctl reload smbd.service 重新加载配置                     
service smbd restart 或者执行重启命令
关闭防火墙:sudo systemctl stop ufw

在windows explorer登录

Ubuntu 20.04.1 共享samba给windows 10_第1张图片

文件只读和只写在writeeable和read only中配置。

注意,当前windows是使用smb的security配置登录的用户,用户登录成功后,我使用的账号和ssh登录的账号是同一个,则smb的读写权限和当前用户权限一样,所以不要出现是当前用户无法更改root权限的文件夹或者文件,最好把共享文件夹设置chwon -r 设置成当前用户

你可能感兴趣的:(ubuntu,windows,linux)