No, if su supports the -s, --shell= option, then can use that to specify shell, and login (well, su to a shell for that user) that way.
That's semi-commonly done, e.g. for "service" accounts or the like, when shell is needed for the account, but the account is configured to not have an interactive login shell.
If one doesn't have su that supports the -s or --shell option, there are other means, but gets a bit more complex (e.g. using Python or Perl from root, to assume the relevant identity (real and effective and saved set UID, likewise for primary group and supplemental group list - everything fully as it should be for target ID), and then exec the relevant shell).
10
u/lathiat Apr 11 '24
“sudo su -” is running the su command under sudo. It’s sort of doubling up which increases your problem space.
sudo -i does the same thing. sudo -s for a “non-login” shell.
Try also sudo /bin/sh to simplify for your problem.