How to execute commands as a user when nologin is configured

I needed to briefly run a couple of commands in a container as a particular non-root user, which sucked because I configured the image based upon alpine, so most of the nice facilities that make modern shell life reasonable are missing.

su - -s /bin/ash nginx

Replace the above user with whatever you’ve got and voila!

Leave a Reply

Your email address will not be published. Required fields are marked *