Reason for the Ubuntu Home folder

Hello,

I created a new container with Ubuntu 20.04. I noticed that a new User and a home directory with the name “Ubuntu” was created automatically.

Is the user really necessary for the container to get it working and does the container have any issues when I delete the user (for harding reason)?
I noticed that this user has even right to login (/etc/passwd) ?

BR

It’s perfectly fine to delete, it’s mostly a backward compatibility thing. We’ve always been creating a default user (uid=1000 gid=1000) and always configured that user to have password-less sudo to root. For many this makes it easy for them to run stuff in the container without just running it as root.

If you’re using one of the cloud-init enabled images, you may be able to tell cloud-init not to create the user in the first place (but those images are larger due to cloud-init being installed, so just removing the user by hand may be a better option).

Thank you very much for your reply

One last question regarding the pre-installed topic. I noticed that ssh is also enabled on the container per default.

I assume that the whole container does still work without any problems when I disable sshd. If this is the case I am I really confused why someone would enable sshd by default.

Hi,

Using the LXD built Ubuntu Focal image via images:ubuntu/focal doesn’t include sshd by default.

Using the official upstream Ubuntu images via ubuntu:focal image does, but the LXD team doesn’t build those images so what is included in it isn’t specified by the LXD team.

But LXD doesn’t rely on sshd being run inside the instance, so it can be disabled.