re[4]: [suse-programming-e] useradd
* Greg Freemyer (freemyer@norcrossgroup.com) [030327 16:15]:
[pid 21991] rename("/etc/passwd+", "/etc/passwd") = -1 EBUSY (Device or resource busy)
That sounds like what should happen. From rename(2):
EBUSY The rename fails because oldpath or newpath is a directory that is in use by some process (perhaps as current working directory, or as root directory, or because it was open for reading) or is in use by the system (for example as mount point), while the system considers this an error. (Note that there is no requirement to return EBUSY in such cases - there is nothing wrong with doing the rename anyway - but it is allowed to return EBUSY if the system cannot otherwise handle such situations.)
It's easy to duplicate this and see that's it's nothing specific to yast or useradd:
hades:/tmp # mkdir test && touch test/motd hades:/tmp # mount --bind /etc/motd test/motd hades:/tmp # mv test/motd test/foo mv: cannot move `test/motd' to `test/foo': Device or resource busy
Really, I wasn't complaining, nor did I think anything was broken. I just could not make it do what I wanted. I know, I'm too demanding. :)
I don't think you mentioned why you want your passwd and shadow file in a directory other than /etc/
I have a series of similar boxes that I want to have identical system disks. Then use mount --bind over to a configuration/data disk for the few unique files like passwd/shadow/group/etc. Then I can QA an update in the lab and use a disk-duplicator to rollout the upgrade.
but you can probably do this chroot.
Very good idea. I should be able to just write a short script: #!/bin/sh chroot /config useradd $* I'm off to give that a shot.
--
-ckm
Greg
* Greg Freemyer (freemyer@NorcrossGroup.com) [030328 10:55]:
I have a series of similar boxes that I want to have identical system disks.
Then use mount --bind over to a configuration/data disk for the few unique files like passwd/shadow/group/etc.
You might just want to rsync /etc, seems much simpler and can be done over ssh if that's a concern.
I should be able to just write a short script:
#!/bin/sh chroot /config useradd $*
You'll need to copy a shell, libc, and whatever else useradd needs into the chroot as well. -- -ckm
participants (2)
-
Christopher Mahmood
-
Greg Freemyer