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