Changing password when quotas are full can break ~/.shadow

Version 1.41


On some systems (proven on a simfs quota system), the system will prevent root from chowning a file to a User, if that User is over quota. (not observed on CentOS). The solution is, when saving a password when quotas are full, to save to: ~/.shadow.temp as root. Attempt a chown on the temp. If the file is not owned by the user after the chown, set the quotas to 0 (off), chown the file, rename the file to ~/.shadow and turn quotas back on. If the chown worked, then the .temp file is renamed normally. Note that all systems will use the temp file & rename method now. The disabling of quotas only happens if the chown didn't stick.

Interested to try DirectAdmin? Get a 30-day Free Trial!