In order to practice my Linux hardening skills, I am trying to launch a web server following certain security principles. My main goal would be to run the server using a dedicated user with very limited privileges. I thought this might be a good use case for creating a server
user with the /usr/sbin/nologin
shell.
But how would I then be supposed to launch the server? When trying to launch a simple command using su
, I am getting an error, even when using -s
to specify a valid shell:
I guess this is the expected behaviour for a user with nologin
shell, but how could that user then launch a server? Should there be some sudo
rules for instance?
For information, my server is a simple Flask
server that launches using a simple wrapper sh
script.