User login as pam-user in lxd

What should i do if i want user login to lxd container via pam?
i mean their shell say pam-user when they ask fx. whoami.

Sorry but LXD support is now being handled by Canonical on the Ubuntu Discourse forum as LXD is no longer a Linux Containers project.

Before I close your topic, I’ll still answer it quickly as that’s a pretty easy one.

If you want to use PAM to login in a LXD container, you can do it either with the built-in alias lxc shell NAME which will get you a root shell but logged in through PAM.

Or you can use lxc exec NAME -- login to go through a normal login prompt that uses PAM. If you don’t want to actually have to enter the login and password, then you can do lxc exec NAME -- su USERNAME -l which will go through the PAM stack too.

You can always define a new convenient command for it through lxc alias.