Unable to Run Command Chsh -S /Bin/Bash ${Username}

I have a docker file where I have customized image myimage derived from some-debian-image (which derived from debian upstream.)

FROM some-debian-image myimge  

USERNAME root:root
...........................
RUN chsh -s /bin/bash ${USERNAME}

docker build fails saying :

Password: chsh: PAM: Authentication failure 

However, it does not fail with upstream

FROM bebain:bullseye myimage

USERNAME root:root
...........................
RUN chsh -s /bin/bash ${USERNAME}

Developers who have build the some-debian-image have done something add on with /etc/passwd , and it is having content

root:x:0:0:root:/root:/usr/sbin/nologin

May I please know how to successfully run this command :

RUN chsh -s /bin/bash ${USERNAME}

I am comparing docker images setup where it is working and where it is not working , and I found that:

The setup where the above command RUN chsh -s /bin/bash ${USERNAME} is working sudo su can be expected without any password

$ sudo su
# 

In contrast in setup where I am facing issue ask for password when run the command sudo su

May I pleas know what changes I should do so that sudo su shall not ask for password?

4
Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article