Description of problem: 'su' can not be used inside anolis-23 container or chroot Version-Release number of selected component (if applicable): util-linux-2.38~rc4-2.an23.aarch64 How reproducible: Steps to Reproduce: 1. create a chroot or docker container of anolis-23, execute: 2. $ useradd foo 3. $ su foo Actual results: reports: su: cannot open session: Permission denied Expected results: switch to user foo Additional info:
docker容器中创建用户报错如下: # useradd test Failed opening /etc/nsswitch.conf: No such file or directory 报错原因是/etc/nsswitch.conf文件不存在,在Anolis OS 23中,/etc/nsswitch.conf文件需要由authselect规则来提供,通过authselect设置规则后,会创建/etc/nsswitch.conf,该文件为软链接: # ls -al /etc/nsswitch.conf lrwxrwxrwx 1 root root 29 Aug 22 08:10 /etc/nsswitch.conf -> /etc/authselect/nsswitch.conf docker容器中需要做好authselect默认策略,当前docker容器是最小安装,可以设置为minimal策略。
by design