Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
There are several reasons why this might not work at all.
The simplest is wrong login shell, e.g. /bin/false for the user.
I would always recommend using --login instead of hyphen, because it reminds you what su actually does.
You might not be in a new shell under the new user at all is the gist of what I'm saying. ;)
Check the return code, e.g. echo ${?}, after su.
getent passwd <username> gives you the users passwd entry, check the shell exists. -
Its docker all the way down. Of course when you run the entrypoint script it "automatically" and "magically" switches you back to root.
I quit. -
@fullstackclown
I think you misunderstood the point of entrypoint.
Entry point is meant to be a script or something that can start a command.
A command can have a default value, but can be overridden...
Whats pretty common is e.g. setting an entrypoint to a shell script.
At the end of the shell script an
exec "${@}" appears.
The exec just executes whatever was fed in as command - but (muey importante):
"If exec is specified with command, it shall replace the shell
with command without creating a new process. If arguments are
specified, they shall be arguments to command. Redirection
affects the current shell execution environment."
Quote from:
https://man7.org/linux/man-pages/...
So the process started by the entrypoint isn't terminated, it keeps on running!
It just gets replaced via the exec call.
This is a very important thing in Dockerfiles - as the container starts otherwise an process that is lost.
Sadly many tutorials explain this in very dumb or idiotic ways - exec is key to Dockerfiles entrypoint and cmd structure.
You will most likely stumble upon exec in every larger docker image for services like MySQL etc. -
Root797672yYeah, it’s one of those days where I don’t work anymore either.
Also: did not read. Too tired. Segfault.
Related Rants
linux wonders:
>su - otheruser
>whoami
root
fuck you!!!!!
it's one of those days where not even basic linux commands are working.... i'm about to give up, i'm so pissed off
rant
rage
just why
so sick of this
why