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 - Unable to Use "chage" Command to Change User Password Expiration Information

edited Sep 3, 2024 6:54AM in Linux

Applies to:

Oracle Cloud Infrastructure - Version N/A and later

Linux x86-64

Symptoms

Using the “chage” command to change the password expiration for a user that fails with the following output:

$ sudo chage -M 45 rootchage: cannot open /etc/passwd

Cause

The /etc/passwd file has the wrong selinux context set, check with:

$ sudo ls -lZ /etc/passwd
-rw-r--r--. root root system_u:object_r:etc_t:s0       /etc/passwd

It should look like this:

$ sudo ls -lZ /etc/passwd
-rw-r--r--. 1 root root system_u:object_r:passwd_file_t:s0 3150 Aug 21 07:49 /etc/passwd

Solution

Change it to default with the following command

Howdy, Stranger!

Log In

To view full details, sign in.

Register

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