安装samba服务器
#ubuntu
sudo apt install samba -y
#almalinux
sudo dnf update
sudo dnf install epel-release mod_ssl
创建共享文件夹
mkdir -p /home/samba
设置权限
chmod -R 755 /home/samba
修改samba配置文件
sudo vim /etc/samba/smb.conf
修改global中的文件内容 新版本中需要添加 map to guest = bad user
security = user
map to guest = bad user
在文件最后添加共享文件选项
[vmshare]
comment = Users profiles
path = /home/samba
guest ok = yes
browseable = yes
create mask = 0755
directory mask = 0755
writable = yes
read only = no
forceuser = root
forcegroup = root
添加防火墙规则
#Ubuntu
sudo ufw allow 'Samba'
sudo firewall-cmd --reload
#almalinux
sudo firewall-cmd --permanent --add-service=samba
sudo firewall-cmd --reload
添加开机启动
#ubuntu
systemctl enable smbd
#almalinux
systemctl enable smb
重启服务
#ubuntu
systemctl restart smbd
#almalinux
systemctl restart smb
访问samba
windows 11
ctrl+r 运行中输入
\\192.168.1.3
enjoy!!! -.-