OCI: Sudo Error This Account Is Currently Not Available.
Applies to:
Oracle Cloud Infrastructure - Version N/A and later
Linux x86-64
Symptoms
sudo to root user fails with the following error:
$ sudo su - This account is currently not available.
Cause
The current shell for root user, defined in /etc/passwd, is /sbin/nologin.
The “/sbin/nologin” does not allow interactive logins or sudo.
$ grep root /etc/passwd root:x:0:0:root:/root:/sbin/nologin
Solution
It's possible to sudo to root by specifying an alternative shell, example:
$ sudo -s /bin/ksh #
From the sudo man page:
-s, --shell Run the shell specified by the SHELL environment variable if it is set or the shell specified by the invoking user's pass‐ word database entry. If a command is specified, it is passed to the shell for execution via the shell's -c option. If no command is specified, an interactive shell is executed. Note that most shells behave differently when a command is speci‐ fied as compared to an interactive session; consult the shell's manual for details.
Tagged:
0