My user is part of the admin group and I'm used to type sudo su to impersonate root. Unfortunately this generate a non-login shell and if I need one I need to type again /bin/bash -l.

Is there any way to have a login shell directly running a sudo command?

1 Answer 1


sudo -i will give you a login shell.

See the sudo manual.

About sudo su, see "Is there ever a good reason to run sudo su?".

  • $ sudo -i results in This account is currently not available. (because of usermod -s /usr/sbin/nologin root) Commented Dec 8, 2020 at 21:52
  • @luckydonald You should ask a new question about this.
    – Kusalananda
    Commented Dec 9, 2020 at 5:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .