1.6 KiB
1.6 KiB
背景
- 不想安装虚拟机或lxc容器
- 可以方便的在pve宿主机直接查询共享的文件
安装samba
- 更换中科大软件源(可选)
sed -i 's|^deb http://ftp.debian.org|deb https://mirrors.ustc.edu.cn|g' /etc/apt/sources.list
sed -i 's|^deb http://security.debian.org|deb https://mirrors.ustc.edu.cn/debian-security|g' /etc/apt/sources.list
- pve 8 执行
echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/pve bookworm pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
- pve 7 执行
echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/pve bullseye pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
- pve 6 执行
echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/pve buster pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
- 更新软件包缓存,安装samba
apt update
apt install samba samba-common -y
配置samba用户以及共享目录
- 添加用户
useradd smbuser
- 设置samba用户密码
smbpasswd -a smbuser
- 创建共享目录
mkdir /mnt/pve/ssd1t/share
- 共享目录设置授权
chown -R smbuser /mnt/pve/ssd1t/share
配置samba服务
- 修改samba配置文件
/etc/samba/samba.conf
文件末尾追加配置,其余默认即可
[share]
comment = smbuser files
path = /mnt/pve/ssd1t/share
guest ok = no
browseable = no
write list = smbuser
重启samba服务
systemctl restart smbd