Operating System - HP-UX
1748202 Members
2945 Online
108759 Solutions
New Discussion юеВ

Changing GID for two users in NIS

 
SOLVED
Go to solution
Vishu
Trusted Contributor

Changing GID for two users in NIS

Hi Masters,

I have HPUX-11.00. i have 2 users in NIS master server, which have been assigned GID of 500, but i want to change GID to 501 and populate the changes on the NIS slave server. These NIS users does not exist in my local /etc/passwd. here is the user difference between local and NIS users.

root # cat /etc/passwd | wc -l
79
root # ypcat passwd | wc -l
5352
root #

Can you please provide the steps to do it. Its a very critical NIS master server. Please suggest on it.

Thanks
26 REPLIES 26
Steven E. Protter
Exalted Contributor

Re: Changing GID for two users in NIS

Shalom,

Change these numbers on the NIS master.

Make sure these users do not exist at all on the NIS slaves except as NIS users. Make sure they do not exist as local users on any system.

ypmake

That should update things.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ganesan R
Honored Contributor

Re: Changing GID for two users in NIS

Hi Ranju,

You have to make the changes on NIS master server source files first and apply the changes to the NIS database.

Edit the /etc/passwd file on NIS master and change the GID or use this command to change it.
#usermod -g 501

Once you modified, run /var/yp/ypmake command. It will update the NIS maps and sync with slave servers.

You can also run yppush on master server or ypxfr on slave servers to synchronize the NIS maps between master and slave servers.
Best wishes,

Ganesh.
Vishu
Trusted Contributor

Re: Changing GID for two users in NIS

Thanks SEP and Ganesan,

but as i pasted above, those users are NIS users only and do not exist in /etc/passwd. then how would i made changes to them on NIS master server.

usermod command will only edit the users in /etc/passwd. but if they dont exist there, then how would i do that. Also, one query, if i run this command

# ypmake passwd

It will update or modify my NIS password database, but i have only 79 users in /etc/passwd and 5352 users in NIS password databse. Would not ypmake overwrite my existing NIS password database(5352) with new one(79 only). Please clear my doubt on it.

if you have commands, can you please paste those here.
Steven E. Protter
Exalted Contributor

Re: Changing GID for two users in NIS

Shalom,

If those users do not exist on the NIS master then they are local users on the system you are testing.

They need to be migrated to the NIS database.

useradd them to the NIS Master

ypmake

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
V. Nyga
Honored Contributor

Re: Changing GID for two users in NIS

Hi,

>These NIS users does not exist in my
>local /etc/passwd. here is the user
>difference between local and NIS users.

So this is local:
>root # cat /etc/passwd | wc -l
>79
and this is NIS:
>root # ypcat passwd | wc -l
>5352
?

That's the sense of NIS - users are ONLY in the NIS server passwd and the clients get the login information from there.
So you don't overwrite anything at the clients, but you have to make the changes at the NIS server.

You also have to change /etc/group !
There GID 501 has to be created, too.

Volkmar
*** Say 'Thanks' with Kudos ***
V. Nyga
Honored Contributor

Re: Changing GID for two users in NIS

Hi again,

also - if you run ypmake command at the client nothing will happen.
If you do it at the NIS client, I don't know, but I believe as long as it run as a client nothing will happen too.
Nevertheless you ONLY make user changes at the NIS server.

You can check which one it is with the command 'ypwhich'.

HTH
Volkmar
*** Say 'Thanks' with Kudos ***
Vishu
Trusted Contributor

Re: Changing GID for two users in NIS

SEP,
They are there in NIS master database. please find the below output. It will give you some picture.

root # ypcat passwd | grep -i spainter
spainter:UlCd2pvwwcC/k,A/BU:11556:500:Seimens walter:/home/spainter:/bin/ksh

root # cat /etc/passwd | grep -i spainter
root #

Please tell how can i change the GID from 500 to 501. i think usermod will only work on /etc/passwd but not on passwd.byname.
Vishu
Trusted Contributor

Re: Changing GID for two users in NIS


@Volkmar

1. Its the NIS master server. and plz tell if i run ypmake on NIS master server, then does it overwrite my existing NIS password database.

2. GID 501 is already exists in /etc/group.
Ganesan R
Honored Contributor
Solution

Re: Changing GID for two users in NIS

Hi Ranju,

Do this. check the content of the file /var/yp/Makefile on NIS master and look at the below entries.

DIR = /etc
..
..
..
PWFILE = $(DIR)/passwd.yp

Makefile is the source file used to create the NIS Maps. Just edit the /etc/passwd.yp file and modify the GID. Once you modify, run the ypmake command which will update the NIS maps and synchronize the slave servers.
Best wishes,

Ganesh.