JerryWilliams wrote:
I am looking for a way to create the home directory and populate it with
the shell profiles.
Normally I would use useradd, but it breaks when you use NIS or LDAP or
winbind.
It would be nice if useradd had an option that would say yes I know this
account exits in LDAP, just make the home directory and fill it with the
normal stuff and don’t put anything in /etc/passwd or /etc/shadow.
For this to actually work, useradd would have to grow features to query
those services. In order to successfully create a usable homedir, you'll
have to know the UID and GID to set as owner for the directory and it's
contents. Of course you could specify this too via switches, but then
doing something like this might actually be easier:
for i in user1 user2 user3 user4; do
cp -a /etc/skel /home/$i
chown -R $(getent passwd $i |cut -d: -f3,4) /home/$i
done
getent passwd should be able to enumerate all your users in the first
place, so this should work.
Disclaimer: The script is an example and might need additional checks
and such to be run safely in a large environment.
--
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list