- https://pve.proxmox.com/wiki/Unprivileged_LXC_containers
- https://github.com/ahuacate/proxmox-lxc-homelab#100-unprivileged-lxc-containers-and-file-permissions
Ctrl + o --> save changes
Ctrl + x --> exit nano
Ctrl + k --> delete line
- On Proxmox create new user group (like homegroup) in Datacenter
- Create new user (like homeuser)
- Create new user on node through command line
groupadd homegroup &&
useradd -g homegroup -m homeuser
- to find out what ids created user has, do
id homeuser
- Create new
zfs pool
- execute for example
zfs create DATA3TB/homeshare/share
- Give to the new created user ownership of this folder
chgrp -R homegroup /DATA3TB/homeshare/share
chown -R homeuser /DATA3TB/homeshare/share
-
Then create new lxc container with ubuntu (for example with
id: 203
). -
Now we need to edit
203.conf
Location of every conf file is in
/etc/pve/lxc/*.conf
To edit203.conf
we execute
nano /etc/pve/lxc/203.conf
- We need to add following lines
mp0: /DATA3TB/homeshare/share/,mp=/mnt/share
lxc.idmap: u 0 100000 1607
lxc.idmap: g 0 100000 1000
lxc.idmap: u 1607 1607 1
lxc.idmap: g 1000 1000 1
lxc.idmap: u 1608 101608 63928
lxc.idmap: g 1001 101001 64535
- First line
mp0...
defines the new share - other lines assume that the user
homeuser
and his grouphomegroup
have id´s ofuser = 1607
andgroup = 1000
- Only once per node (proxmox server) following files have also to be edited:
/etc/subuid
/etc/subgid
- In both files we add lines:
- in subuid
root:1607:1
- in subgid
root:1000:1
- in subuid
-
To test if the mount and rights has worked, we test it when we login into lcs container and execute
df -h
.We must see our share
/mnt/share/
-
Then we can try to create new file or folder in that location
mkdir /mnt/share/testfolder
If we don´t receive any error, then everything is fine.
-
In lcx container install samba for sharing with
apt update && apt install samba -Y
-
After that we modify samba config file
mv /etc/samba/smb.conf /etc/samba/smb.bak
nano /etc/samba/smb.conf
- The configration looks like this
[global]
workgroup = WORKGROUP
[data]
path = /mnt/share
writeable = yes
browseable = yes
valid user = homeuser
-
After every change of
smb.conf
file, we need to restart samba service withsystemctl restart smbd.service
-
We create new samba user and linux user with same password.
smbpasswd -a homeuser
groupadd -g 1000 homegroup &&
useradd -u 1607 -g homegroup -m homeuser
passwd homeuser
- Docker on Proxmox with portainer
apt update
apt install docker.io
systemctl start docker
systemctl enable docker
### install docker-compose ###
apt install curl
curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
## install portainer ##
docker volume create portainer_data
docker run -d -p 9100:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /data/configs/dockerconfig/portainer:/data -e TZ=Europe/Berlin portainer/portainer:latest
- Create cifs (samba share) in ubuntu VM (not LXC!)
Important Add in /etc/fstab file "argument" nolock
!
- Create nfs (synology share) in ubuntu VM.
- If the current user in Ubuntu has only
$
in shell, then follwoing command has to be executed to repair it:
chsh -s /bin/bash john