Operating System - HP-UX
1753808 Members
7626 Online
108805 Solutions
New Discussion юеВ

How to force/change uid and gid of an user?

 
SOLVED
Go to solution
Enrico Venturi
Super Advisor

How to force/change uid and gid of an user?

Hello colleagues,
I've a system with MC/SG; when a package switches all the related files are "managed" by the new active node, therefore I need to have all the users existing on both the main node and on the spare node.
It's mostly important that the uid and the gid of the users are the same on both the node.
Is is possible to force the uid and the gid of an user? As concerning the gid, can I force the identifier to be the same on both the nodes? For instance, the group dba should have the same identofier 101 on main and spare nodes.

Regards
Enrico
5 REPLIES 5
Elmar P. Kolkman
Honored Contributor

Re: How to force/change uid and gid of an user?

This is why most clusters use NIS for group and passwd, at least the ones I've seen. You could also run a monitor script that checks this across the nodes of your cluster.
Every problem has at least one solution. Only some solutions are harder to find.
Stefan Farrelly
Honored Contributor

Re: How to force/change uid and gid of an user?

usermod can force change the gid for a user.

We run identical (or as identical as possible) passwd and group files on all nodes in a MC/SG cluster so in the event of a failover everything works straight off.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Enrico Venturi
Super Advisor

Re: How to force/change uid and gid of an user?

Stefan,
my problem is exactly how to make the passwd/groups files to be identical across the nodes ....
Elmar P. Kolkman
Honored Contributor

Re: How to force/change uid and gid of an user?

Get them all on one server, lets say in /var/tmp, call them passwd. and group.

Now do this: cat passwd.* | sort -u >passwd.total

Now you have a passwd files with all entries, sorted by username. You now have to look into that file for multiple lines and see what's the difference between lines with the same username but some differenc on the rest of the line, fix it.
The same has to be done for the group file.
When ready, you can distribute that file to all nodes.


If you have to change user-id's or group id's you can use find to change all files with wrong id's on the server where the uid/gid is changed.
Every problem has at least one solution. Only some solutions are harder to find.
Madhu Sudhan_1
Respected Contributor
Solution

Re: How to force/change uid and gid of an user?

First time sync can be done as suggested by Elmar.

In the long run NIS is the option for you.

Thank you,
Madhu
Think Positive