Question

I'm working on a home-grown user database tied to a larger sustainment application.

The idea has been floated around to tie our users to system users, creating matching /etc/passwd entries each time a new user is generated in our program. Other interaction such as querying uid/gid for username or vice-versa, verifying filesystem ownership, etc. We've already got standard fields defined like user.uid, user.gid, user.home, internal permissions, etc and just need a way to pass these through to the system.

The trouble is, searching for any info online is a needle in a haystack scenario- I haven't been able to find any standard libraries for user account getters and setters, and I'm starting to wonder if these even exist? Is the right approach here to spawnv useradd? It seems like there must be a better way!

Note that the system this is running on is single use (virtualized), for all intents and purposes.

Final edit: It turns out that the most economical solution is:

useradd -g group -c "firstname lastname" -d /export/home/username -m -s /bin/bash username
Était-ce utile?

La solution

Is useradd what you are looking for?

useradd -g group -c "firstname lastname" -d /export/home/username -s /bin/ksh username
mkdir -p /export/home/username
chown username /export/home/username

Autres conseils

You could make your program into a NIS. Can't help you actually do it, but it might be worth looking at for you.

Added: You might be able to use ldap as well.

But any of those two would mean that you only need to keep the DB up to date. The passwd would take care of itself

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top