kgdrenefort wrote:Hello, as the topic says, I have an user without home, should not have one.
Firstly, why should it not have a valid home directory? Is there a substantive technical reason?
As did the person who
opened this thread, you have found that there can sometimes be adverse consequences for specifying a home directory that is invalid. In your case, the situation is worse because crontab(1) wants to be able to use a transient directory to back up the existing crontab, if any. To quote its man page:
On edition or deletion of the crontab, a backup of the last crontab will be saved to $XDG_CACHE_HOME/crontab/crontab.bak or $XDG_CACHE_HOME/crontab/crontab.<user>.bak if -u is used. If the XDG_CACHE_HOME environment variable is not set, $HOME/.cache will be used instead.
Note that the English is a little off there. It should really begin with something like "Upon editing or deleting the crontab". As I see it, you have three options at your disposal. I'll list them in what I believe to be reverse order of desirability.
Option #1: The obviously correct solution: create and assign a valid home directory. Metaphorically speaking, stop trying to push the door that's labelled pull.
Option #2: Attempt to persuade the cronie maintainers to have an option whereby the creation of the backup can be suppressed.
Option #3: Falsify XDG_CACHE_HOME in the environment of crontab(1) at the time of executing it. To do this would seem silly as it would only highlight the fact that crontab(1) wants to be able to stash a backup to a user-writeable directory using a predictable relative path to begin with. Even if you were to falsify it as, say, /tmp, there would be side effects. In particular, it would not scale beyond being applicable to one single user bearing an invalid home directory (there might well be a conflict of ownership).