Unable to change password for a user.

I am getting the following error message "passwd: User unknown: username" Permission denied error message when trying to change the password for that given user account.

The user account is within the /etc/passwd file and I can also su to the account without any problems. This is sever is not using NIS, the passwd field is set to "files"

The OS tells username doesn't exists. It obviously cannot change a password if that account is not already created. What makes you feel the account exists ?

I know the account exists because I can see the account information within the passwd file; I also used the account several days ago without any problems. I can also "su" to that account name without any problems. The OS is also showing the owner / group information for the account without any problems.

That's not enough for a password to be set/changed. Your account is probably missing from the /etc/shadow file. You probably never logged in under that account.

Yes, the user account is within the shadow file, and has a password set. As I stated before, I have logged in and used this account several times before.

Then you'll need to provide more evidence about what's going on. Possibly a locked out account. Please copy/paste the precise command and error message you got when trying to change the password and the output of:

id
grep username /etc/passwd
grep username /etc/shadow

grep oracle /etc/passwd
oracle:x:122:120:oracle:/u01/app/oracle:/bin/ksh
grep oracle /etc/shadow
oracle:uHa6fqtxFULe6:14687::::::

as root, su to oracle

su - oracle
id
uid=122(oracle) gid=120(dba)

as root, try to change password
passwd oracle
passwd: User unknown: oracle
Permission denied

Your password file might be corrupted elsewhere.
Run "pwconv" as root and see if it complains.

Also have a look at your /etc/pam.conf, has it been changed recently???

I ran the pwconv command and it complained about a blank line prior to the user account in question. Upon looking at the passwd file, on line 25, there was a ":" missing between the two fields. I fix the problem and everything is working as expected.

Thanks for the help!

For completeness. If you are experienced enought to manually edit a passwd file, backup passwd, shadow and group first.
Use "vipw" not just "vi" and then run "pwconv", "pwck" and "grpck" to maintain and check the integrity of the files.

And for even more completeness, be aware that the useful vipw command:

  • is located in the /usr/ucb directory so might not be in your PATH
  • is not part of core solaris, i.e. is optional so might not be present in your installation
  • might disappear in future releases as this SunOS/BSD Compatibility Package was supposed to be transitional only.

Vipw is however still maintained as a recent fix corrected its reluctance to have root's home directory not being /.