Pastebin style!
lxc-create -B lvm --lvname lxc-server-2022 --vgname fast-vg --fstype ext4 --fssize 32G -n server-2022 -t debian -- -r bullseye
lvcreate --size=180G --name=server-var lxchostserver-vg
mkfs.ext4 -m0 -L server-var /dev/mapper/lxchostserver--vg-server--var
Separate logical partition for samba data on LXC.
/var/lib/lxc/smb_server_name/config
add:
lxc.mount.entry = /dev/mapper/lxchostserver--vg-smb_server_name--var var/local/samba ext4 defaults,acl 0 0
mkfs.ext4 -m0 -L server-var /dev/mapper/lxchostserver--vg-server--var
mount /dev/mapper/fast--vg-lxc--server--2022 server-2022/
lxc-stop server-2022
lxc-start server-2022
lxc-attach -n server-2022
Copy old /etc/passwd
or better yet, copy only the users/lines you still need. Avoid copying /etc/shadow
file, as hash algorythm could be weak. $1
for example means MD5 hash, that is succeptible to collision attacks.
Create a new hashed password for every user, add it to samba and enable it:
USERNAME=b4d ; passwd $USERNAME ; smbpasswd -a $USERNAME ; smbpasswd -e $USERNAME
Check all the users in samba:
pbedit -L
Review and copy old samba config /etc/samba/smb.conf
.
On the old server, start the data sync:
rsync -avAX /var/local/samba/ root@server-2022:/var/local/samba
systemctl enable smbd
systemctl status smbd