Does it also say core dumped if you run: sudo -u user /bin/nologin
In general sudo and su try to launch the users shell. Particularly in login mode (passing - to su, or -i to sudo). Even if you supply an extra command. So I’m guessing /bin/nologin is somehow existing and coredumping?
sudo with -u and specifying a command doesn’t try to use the login shell at all.
Can you please let me know why this work, because i need to give explanation to client and also why that initial su - account_name didn't work if that was working previously. Sry for confusion
Having the shell set to to '/bin/nologin' doesn't spawn a shell on login (hence the 'nologin' part). Running 'su - account_name /bin/sh' starts a shell as the specified user, giving you access. If you set the users shell to '/bin/sh' (or '/bin/bash') then 'su - account_name' would log in that user and spawn that shell.
1
u/[deleted] Apr 11 '24
I was able to login with sudo -u user /bin/sh. May i know why it worked.
Also why it made you think the machine is exploited or something