holo icon indicating copy to clipboard operation
holo copied to clipboard

holo-users-groups: home directory is not created

Open mipimipi opened this issue 6 years ago • 5 comments

Hi, I use the following toml file to create a user:

[[user]]
name    = "mipi"
system  = false
comment = "mipi"
groups  = [ "wheel", "network", "audio", "video", "sys" ]
home    = "/home/mipi"
shell   = "/usr/bin/zsh"

But though I specify a home directory, it is not created. When I logon as user mipi, I get the error message

mkdir: cannot create directory '/home/mipi': Permission denied

How can I resolve this?

Thanks, mipi

mipimipi avatar Nov 07 '18 05:11 mipimipi

I usually put the user's home directory in the configuration package, e.g. https://github.com/majewsky/system-configuration/blob/30dbd7c9e2ef0c66dd7eea398755706a3e05be8b/hologram-archlinux-mirror.pkg.toml#L15-L24 (Note that this is a package declaration for holo-build, not for holo-users-groups directly.)

Doing this separately, while slightly more tedious, has the advantage that you have explicit control over ownership and permissions of the homedir.

majewsky avatar Nov 07 '18 08:11 majewsky

Did it now the same way and it worked :-) However, I'd expect that holo-users-groups creates the homedir if it's not existing, esp. if it's specified explicitely in the toml file.

mipimipi avatar Nov 09 '18 07:11 mipimipi

I agree that this would be a useful option. A create_home = true option should be added to holo-users-groups that mirrors the --create-home switch of useradd(8). It's not a priority for me, but if anyone reading this feels like adding this, I'll be happy to review a PR.

majewsky avatar Nov 10 '18 10:11 majewsky

I think I could do that. After looking into the coding, I believe that adding that feature is not a big deal. I still did not get how the test suite is working. Which steps would I have to execute to (a) include a test for the new feature into the test suite and (b) test the new feature?

mipimipi avatar Nov 20 '18 00:11 mipimipi

I looked at this last evening a bit. It's not as straightforward as it seems:

  • If the entity definition changes, do we move the home directory, create a new one, or ignore the change?
  • If the user is removed, do we remove the home, or leave it? What if it has files?

For both there seems to be no "obviously correct" behaviour. I'd like to see this feature, but I'm not 100% it can be implemented in a non-problematic way.

WhyNotHugo avatar Jul 27 '22 12:07 WhyNotHugo