From e92f5d1c189af7ce8aeb8afae2365c96832d3921 Mon Sep 17 00:00:00 2001 From: akanealw Date: Wed, 17 Apr 2024 00:20:45 +0000 Subject: [PATCH 01/11] docs: create home/proxmox/Proxmox-lxc-usermappings --- home/proxmox/Proxmox-lxc-usermappings.md | 46 ++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 home/proxmox/Proxmox-lxc-usermappings.md diff --git a/home/proxmox/Proxmox-lxc-usermappings.md b/home/proxmox/Proxmox-lxc-usermappings.md new file mode 100644 index 0000000..2a28abd --- /dev/null +++ b/home/proxmox/Proxmox-lxc-usermappings.md @@ -0,0 +1,46 @@ +--- +title: Promox-lxc-usermappings +description: +published: true +date: 2024-04-17T00:20:40.035Z +tags: +editor: markdown +dateCreated: 2024-04-17T00:20:40.035Z +--- + +# Userid mappings +```bin +lxc.idmap: u 0 100000 1000 +lxc.idmap: g 0 100000 1000 +lxc.idmap: u 1000 1000 1 +lxc.idmap: g 1000 1000 1 +lxc.idmap: u 1001 101001 64534 +lxc.idmap: g 1001 101001 64534 +``` + +I see what's happening. This is the default behavior of an unprivileged containers. When you create an unprivileged container, by default the uid/gid in the container are mapped to the range of 100000-165535 uid/gid on the host. + +So when you create a user in the container with uid 1000, it will be mapped to uid 101000 on the host. Any files/directories you create under this default mapping will be recognized as uid 101000 by the host system. + +The reason the ownership changed to nobody/nogroup is because you later provided a custom mapping. Now uid 1000 in the container is not mapped to 101000 on the host, it is now mapped directly to uid 1000 on the host. In fact uid 101000 is no longer mapped at all, so Proxmox doesn't recognize it and assigns it as nobody/nogroup. + +lxc.idmap: u 0 100000 1000 //maps 0-999(CT) -> 100000-100999(Host) +lxc.idmap: u 1000 1000 1 //maps 1000(CT) -> 1000(Host) +lxc.idmap: u 1001 101001 64535 //maps 1001-65535(CT) -> 101001-165535(Host) + +To fix this: + +1. Remove the mappings in config and restart the CT. This should revert the ownership back to akanealw. + +2. Then use root/sudo to change ownership of the directory/files to root on the container +```bin +sudo chown root:root -R /home/akanealw +``` + +3. Next, shutdown the container and reapply the mappings in config. Now when you restart the container, /home/akanealw should still be owned by root. + +4. Lastly, using container's root and change ownership back to the newly mapped akanealw +```bin +sudo chown akanealw:akanealw -R /home/akanealw +``` + From 98dd61acf2d42d82911bd6948afe984fecb78cf4 Mon Sep 17 00:00:00 2001 From: akanealw Date: Wed, 17 Apr 2024 01:08:35 +0000 Subject: [PATCH 02/11] docs: create home/openwrt --- home/openwrt.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 home/openwrt.md diff --git a/home/openwrt.md b/home/openwrt.md new file mode 100644 index 0000000..80831e6 --- /dev/null +++ b/home/openwrt.md @@ -0,0 +1,41 @@ +--- +title: openwrt-tftp +description: +published: true +date: 2024-04-17T01:08:32.709Z +tags: +editor: markdown +dateCreated: 2024-04-17T01:08:32.709Z +--- + +# openwrt tftp settings +```bin +config match + option networkid 'bios' + option match '60,PXEClient:Arch:00000' +config match + option networkid 'efi64' + option match '60,PXEClient:Arch:00009' +config match + option networkid 'efi64' + option match '60,PXEClient:Arch:00007' +config userclass + option networkid 'ipxe' + option userclass 'iPXE' +config boot + option filename 'tag:bios,tag:!ipxe,bios/srv/tftp/ipxe.kpxe' + option serveraddress '192.168.1.1' + option servername 'router' +config boot + option filename 'tag:bios,tag:ipxe,bios/srv/tftp/ipxe.kpxe' + option serveraddress '192.168.1.1' + option servername 'router' +config boot + option filename 'tag:efi64,tag:!ipxe,efi64/srv/tftp/ipxe.efi' + option serveraddress '192.168.1.1' + option servername 'router' +config boot + option filename 'tag:efi64,tag:ipxe,efi64/ipxe/srv/tftp/ipxe.efi'' + option serveraddress '192.168.1.1' + option servername 'router' +``` \ No newline at end of file From d5c9d3217e9ba5efb798a2fc35e1c96ce576a087 Mon Sep 17 00:00:00 2001 From: akanealw Date: Wed, 17 Apr 2024 01:12:01 +0000 Subject: [PATCH 03/11] docs: create home/openwrt/openwrt-tftp-settings --- home/openwrt/openwrt-tftp-settings.md | 41 +++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 home/openwrt/openwrt-tftp-settings.md diff --git a/home/openwrt/openwrt-tftp-settings.md b/home/openwrt/openwrt-tftp-settings.md new file mode 100644 index 0000000..936155f --- /dev/null +++ b/home/openwrt/openwrt-tftp-settings.md @@ -0,0 +1,41 @@ +--- +title: openwrt-tftp-settings +description: +published: true +date: 2024-04-17T01:11:58.956Z +tags: +editor: markdown +dateCreated: 2024-04-17T01:11:58.956Z +--- + +# openwrt tftp settings +```bin +config match + option networkid 'bios' + option match '60,PXEClient:Arch:00000' +config match + option networkid 'efi64' + option match '60,PXEClient:Arch:00009' +config match + option networkid 'efi64' + option match '60,PXEClient:Arch:00007' +config userclass + option networkid 'ipxe' + option userclass 'iPXE' +config boot + option filename 'tag:bios,tag:!ipxe,bios/srv/tftp/ipxe.kpxe' + option serveraddress '192.168.1.1' + option servername 'router' +config boot + option filename 'tag:bios,tag:ipxe,bios/srv/tftp/ipxe.kpxe' + option serveraddress '192.168.1.1' + option servername 'router' +config boot + option filename 'tag:efi64,tag:!ipxe,efi64/srv/tftp/ipxe.efi' + option serveraddress '192.168.1.1' + option servername 'router' +config boot + option filename 'tag:efi64,tag:ipxe,efi64/ipxe/srv/tftp/ipxe.efi'' + option serveraddress '192.168.1.1' + option servername 'router' +``` From bc8af785aff13743e86a6304bc6c6cde33e34b94 Mon Sep 17 00:00:00 2001 From: akanealw Date: Wed, 17 Apr 2024 01:12:32 +0000 Subject: [PATCH 04/11] docs: delete home/openwrt/openwrt-tftp-settings --- home/openwrt/openwrt-tftp-settings.md | 41 --------------------------- 1 file changed, 41 deletions(-) delete mode 100644 home/openwrt/openwrt-tftp-settings.md diff --git a/home/openwrt/openwrt-tftp-settings.md b/home/openwrt/openwrt-tftp-settings.md deleted file mode 100644 index 936155f..0000000 --- a/home/openwrt/openwrt-tftp-settings.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: openwrt-tftp-settings -description: -published: true -date: 2024-04-17T01:11:58.956Z -tags: -editor: markdown -dateCreated: 2024-04-17T01:11:58.956Z ---- - -# openwrt tftp settings -```bin -config match - option networkid 'bios' - option match '60,PXEClient:Arch:00000' -config match - option networkid 'efi64' - option match '60,PXEClient:Arch:00009' -config match - option networkid 'efi64' - option match '60,PXEClient:Arch:00007' -config userclass - option networkid 'ipxe' - option userclass 'iPXE' -config boot - option filename 'tag:bios,tag:!ipxe,bios/srv/tftp/ipxe.kpxe' - option serveraddress '192.168.1.1' - option servername 'router' -config boot - option filename 'tag:bios,tag:ipxe,bios/srv/tftp/ipxe.kpxe' - option serveraddress '192.168.1.1' - option servername 'router' -config boot - option filename 'tag:efi64,tag:!ipxe,efi64/srv/tftp/ipxe.efi' - option serveraddress '192.168.1.1' - option servername 'router' -config boot - option filename 'tag:efi64,tag:ipxe,efi64/ipxe/srv/tftp/ipxe.efi'' - option serveraddress '192.168.1.1' - option servername 'router' -``` From 4ca9a405fa203c0e73b75f8f52ffa69d7183e06f Mon Sep 17 00:00:00 2001 From: akanealw Date: Wed, 17 Apr 2024 01:12:44 +0000 Subject: [PATCH 05/11] docs: delete home/openwrt --- home/openwrt.md | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 home/openwrt.md diff --git a/home/openwrt.md b/home/openwrt.md deleted file mode 100644 index 80831e6..0000000 --- a/home/openwrt.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: openwrt-tftp -description: -published: true -date: 2024-04-17T01:08:32.709Z -tags: -editor: markdown -dateCreated: 2024-04-17T01:08:32.709Z ---- - -# openwrt tftp settings -```bin -config match - option networkid 'bios' - option match '60,PXEClient:Arch:00000' -config match - option networkid 'efi64' - option match '60,PXEClient:Arch:00009' -config match - option networkid 'efi64' - option match '60,PXEClient:Arch:00007' -config userclass - option networkid 'ipxe' - option userclass 'iPXE' -config boot - option filename 'tag:bios,tag:!ipxe,bios/srv/tftp/ipxe.kpxe' - option serveraddress '192.168.1.1' - option servername 'router' -config boot - option filename 'tag:bios,tag:ipxe,bios/srv/tftp/ipxe.kpxe' - option serveraddress '192.168.1.1' - option servername 'router' -config boot - option filename 'tag:efi64,tag:!ipxe,efi64/srv/tftp/ipxe.efi' - option serveraddress '192.168.1.1' - option servername 'router' -config boot - option filename 'tag:efi64,tag:ipxe,efi64/ipxe/srv/tftp/ipxe.efi'' - option serveraddress '192.168.1.1' - option servername 'router' -``` \ No newline at end of file From 9d9db916b0c3c84744b8268afb8179a968c1b432 Mon Sep 17 00:00:00 2001 From: akanealw Date: Wed, 17 Apr 2024 01:15:00 +0000 Subject: [PATCH 06/11] docs: create openwrt/openwrt-tftp-settings --- openwrt/openwrt-tftp-settings.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 openwrt/openwrt-tftp-settings.md diff --git a/openwrt/openwrt-tftp-settings.md b/openwrt/openwrt-tftp-settings.md new file mode 100644 index 0000000..7c52198 --- /dev/null +++ b/openwrt/openwrt-tftp-settings.md @@ -0,0 +1,12 @@ +--- +title: openwrt-tftp-settings +description: +published: true +date: 2024-04-17T01:14:58.008Z +tags: +editor: markdown +dateCreated: 2024-04-17T01:14:58.008Z +--- + +# openwrt tftp settings +fjakls;djf \ No newline at end of file From 39a44eb89b1de00ba93941a66420d1b90080f66a Mon Sep 17 00:00:00 2001 From: akanealw Date: Wed, 17 Apr 2024 01:15:35 +0000 Subject: [PATCH 07/11] docs: delete openwrt/openwrt-tftp-settings --- openwrt/openwrt-tftp-settings.md | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 openwrt/openwrt-tftp-settings.md diff --git a/openwrt/openwrt-tftp-settings.md b/openwrt/openwrt-tftp-settings.md deleted file mode 100644 index 7c52198..0000000 --- a/openwrt/openwrt-tftp-settings.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: openwrt-tftp-settings -description: -published: true -date: 2024-04-17T01:14:58.008Z -tags: -editor: markdown -dateCreated: 2024-04-17T01:14:58.008Z ---- - -# openwrt tftp settings -fjakls;djf \ No newline at end of file From fe4b25eafb318a14f34ce6520201296ead770c66 Mon Sep 17 00:00:00 2001 From: akanealw Date: Wed, 17 Apr 2024 01:16:49 +0000 Subject: [PATCH 08/11] docs: create home/openwrt/openwrt-tftp-settings --- home/openwrt/openwrt-tftp-settings.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 home/openwrt/openwrt-tftp-settings.md diff --git a/home/openwrt/openwrt-tftp-settings.md b/home/openwrt/openwrt-tftp-settings.md new file mode 100644 index 0000000..1e5892f --- /dev/null +++ b/home/openwrt/openwrt-tftp-settings.md @@ -0,0 +1,13 @@ +--- +title: openwrt-tftp-settings +description: +published: true +date: 2024-04-17T01:16:47.323Z +tags: +editor: markdown +dateCreated: 2024-04-17T01:16:47.323Z +--- + +# openwrt tftp settings + +Your content here \ No newline at end of file From eec7f4c8ec46a05dd956461f3a288fa75c25bf71 Mon Sep 17 00:00:00 2001 From: akanealw Date: Wed, 17 Apr 2024 01:17:26 +0000 Subject: [PATCH 09/11] docs: update home/openwrt/openwrt-tftp-settings --- home/openwrt/openwrt-tftp-settings.md | 34 ++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/home/openwrt/openwrt-tftp-settings.md b/home/openwrt/openwrt-tftp-settings.md index 1e5892f..0d86cdd 100644 --- a/home/openwrt/openwrt-tftp-settings.md +++ b/home/openwrt/openwrt-tftp-settings.md @@ -2,12 +2,40 @@ title: openwrt-tftp-settings description: published: true -date: 2024-04-17T01:16:47.323Z +date: 2024-04-17T01:17:24.054Z tags: editor: markdown dateCreated: 2024-04-17T01:16:47.323Z --- # openwrt tftp settings - -Your content here \ No newline at end of file +```bin +config match + option networkid 'bios' + option match '60,PXEClient:Arch:00000' +config match + option networkid 'efi64' + option match '60,PXEClient:Arch:00009' +config match + option networkid 'efi64' + option match '60,PXEClient:Arch:00007' +config userclass + option networkid 'ipxe' + option userclass 'iPXE' +config boot + option filename 'tag:bios,tag:!ipxe,bios/srv/tftp/ipxe.kpxe' + option serveraddress '192.168.1.1' + option servername 'router' +config boot + option filename 'tag:bios,tag:ipxe,bios/srv/tftp/ipxe.kpxe' + option serveraddress '192.168.1.1' + option servername 'router' +config boot + option filename 'tag:efi64,tag:!ipxe,efi64/srv/tftp/ipxe.efi' + option serveraddress '192.168.1.1' + option servername 'router' +config boot + option filename 'tag:efi64,tag:ipxe,efi64/ipxe/srv/tftp/ipxe.efi'' + option serveraddress '192.168.1.1' + option servername 'router' +``` \ No newline at end of file From 4569b3d59804a3fb7e852982c0154b63de082b88 Mon Sep 17 00:00:00 2001 From: akanealw Date: Wed, 17 Apr 2024 01:17:33 +0000 Subject: [PATCH 10/11] docs: update home/openwrt/openwrt-tftp-settings --- home/openwrt/openwrt-tftp-settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/openwrt/openwrt-tftp-settings.md b/home/openwrt/openwrt-tftp-settings.md index 0d86cdd..1860c9e 100644 --- a/home/openwrt/openwrt-tftp-settings.md +++ b/home/openwrt/openwrt-tftp-settings.md @@ -2,7 +2,7 @@ title: openwrt-tftp-settings description: published: true -date: 2024-04-17T01:17:24.054Z +date: 2024-04-17T01:17:32.020Z tags: editor: markdown dateCreated: 2024-04-17T01:16:47.323Z From 2d99030551463017bb3f70015c9b8e8673000c4c Mon Sep 17 00:00:00 2001 From: akanealw Date: Wed, 17 Apr 2024 01:22:21 +0000 Subject: [PATCH 11/11] docs: update home/openwrt/openwrt-tftp-settings --- home/openwrt/openwrt-tftp-settings.md | 36 +++++++++++++++++---------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/home/openwrt/openwrt-tftp-settings.md b/home/openwrt/openwrt-tftp-settings.md index 1860c9e..f5d0239 100644 --- a/home/openwrt/openwrt-tftp-settings.md +++ b/home/openwrt/openwrt-tftp-settings.md @@ -2,7 +2,7 @@ title: openwrt-tftp-settings description: published: true -date: 2024-04-17T01:17:32.020Z +date: 2024-04-17T01:22:19.347Z tags: editor: markdown dateCreated: 2024-04-17T01:16:47.323Z @@ -10,32 +10,42 @@ dateCreated: 2024-04-17T01:16:47.323Z # openwrt tftp settings ```bin + option enable_tftp '1' + option tftp_root '/srv/tftp' + config match option networkid 'bios' option match '60,PXEClient:Arch:00000' + config match option networkid 'efi64' option match '60,PXEClient:Arch:00009' + config match option networkid 'efi64' option match '60,PXEClient:Arch:00007' + config userclass option networkid 'ipxe' option userclass 'iPXE' + config boot - option filename 'tag:bios,tag:!ipxe,bios/srv/tftp/ipxe.kpxe' - option serveraddress '192.168.1.1' - option servername 'router' + option filename 'tag:bios,tag:!ipxe,ipxe.kpxe' + option serveraddress '192.168.1.1' + option servername 'router' + config boot - option filename 'tag:bios,tag:ipxe,bios/srv/tftp/ipxe.kpxe' - option serveraddress '192.168.1.1' - option servername 'router' + option filename 'tag:bios,tag:ipxe,ipxe.kpxe' + option serveraddress '192.168.1.1' + option servername 'router' + config boot - option filename 'tag:efi64,tag:!ipxe,efi64/srv/tftp/ipxe.efi' - option serveraddress '192.168.1.1' - option servername 'router' + option filename 'tag:efi64,tag:!ipxe,ipxe.efi' + option serveraddress '192.168.1.1' + option servername 'router' + config boot - option filename 'tag:efi64,tag:ipxe,efi64/ipxe/srv/tftp/ipxe.efi'' - option serveraddress '192.168.1.1' - option servername 'router' + option filename 'tag:efi64,tag:ipxe,ipxe.efi' + option serveraddress '192.168.1.1' + option servername 'router' ``` \ No newline at end of file