I remember it was working some time ago. How do I re-enable it?
You were almost certainly using sudo -i
before, since su
doesn't support an -i
option, and it has not supported such an option even in earlier releases. (Just to be sure, I've double-checked this on 16.04 LTS.) You can still use sudo -i
.
On a system where root logins are enabled, you can enter su
and authenticate with root's password. This gives you a root shell but it does not simulate a login shell. It is similar to sudo -s
(or sudo --shell
), which works even when the root account is disabled. With sudo
, you use your own password. In the default configuration, you must be an administrator--i.e., a member of the sudo
group--to use it.
Similarly, if you can log in as root then you can also simulate a root login with su -
(or su -l
, or su --login
). Passing the -
flag to su
sets environment variables similar to those that would be set in root's login environment and starts a login shell. It is similar to sudo -i
(or sudo --login
).
The most common way to use sudo
is to run just a single command, just by running sudo command args...
. This can also be done with su
by passing the -c
flag, but it is awkward because the whole command including its arguments have to be quoted so it is passed as a single command-line argument to su
: su -c 'command args...'
(If you're not passing any arguments to the command, and the command name itself doesn't require quoting, then the quotes may be omitted.)
I mention all this not to provide a complete guide to sudo
, and I recommend man sudo
, RootSudo, this thread, this question, the tag wiki, and the upstream site for more information. Aside from showing the commands you are most likely to want, my main point is that even to do similar things, sudo
and su
use quite differently named short-form options, including for --login
. If you ever ran a command to get a root shell, and you passed -i
, that command was most likely sudo
.