Could not chdir to home directory

Since migrating to FreeIPA I have some users that receive the following error on certain Ubuntu machines even though they are all Ubuntu 22.04.

Could not chdir to home directory /home/gregory: Permission denied
-bash: /home/gregory/.bash_profile: Permission denied

Has anybody else experience this?

1 Like

Usually those errors mean that the user does not have permissions on the home directory, or the home directory doesn’t exist - eg is not being created when the user logs in for the first time.

You can manually solve that by doing:

mkdir /home/gregory
chown -R gregory:gregory /home/gregory

but ideally you want to resolve it so that pam creates those directories on login. pam create home directory on login - Google Search or freeipa create home directory on login - Google Search

The creation of home can (optionally) put some config files (from /etc/skel) into the (new) home as well. I’d mimic that (if desired) with:

FF=gregory
mkdir -v /home/${FF}
rsync -av --chown=${FF}:${FF} /etc/skel/ /home/${FF}/
chmod -v 700 /home/${FF}

However, are these “new” users – logging into client first time?
Should the home be in the client’s local disk?

If they are not new, then perhaps the identity from the FreeIPA does not match the old uid/gid/groups/homepath?