You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

OCI: Sudo Error This Account Is Currently Not Available.

in Linux 2 comments

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.

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!