LXC unprivilleged container

See How to best ask questions on this discussion forum for formatting tips (preformatted style).

Once you get a shell as root in the container, you can create a non-root account. Then, get a new shell into that container as that non-root account. It’s not clear what commands you are running above, so I cannot help you directly.

Here is me creating a container with Incus.

$ incus launch images:debian/13/cloud mycontainer
Launching mycontainer
$ incus exec mycontainer -- su -l debian
debian@mycontainer:~$ id
uid=1000(debian) gid=1000(debian) groups=1000(debian),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev)
debian@mycontainer:~$ sudo id
uid=0(root) gid=0(root) groups=0(root)
debian@mycontainer:~$ hostname
mycontainer
debian@mycontainer:~$ hostname mynewhostname
hostname: you must be root to change the host name
debian@mycontainer:~$ sudo hostname mynewhostname
debian@mycontainer:~$ hostname
mynewhostname
debian@mycontainer:~$ exit
logout
$