pw user mod for nis master.passwd

I'm having an issue with my NIS system. I am trying to use pw to change a password of a user on my NIS. I have all the NIS users in a /var/yp/master.passwd file.

When I use the command:

echo 'password' | pw mod user TestUser -Y -y /var/yp/master.passwd -h 0

I get an error:

pw: no such user `TestUser'

Do I need another switch to specify this is a NIS file? I think it is still looking for TestUser in the /etc/master.passwd file... and it doesn't exist there.

Any help would be greatly appreciated.

Thanks
 
Never used it myself but if I read the -Y option correctly it's already in /var/yp/. So I would guess you need to supply the path relative from /var/yp/: pw mod user TestUser -Y -y master.passwd -h 0

Code:
     -Y            Using this option with any of the update modes causes pw to
                   run make(1) after changing to the directory /var/yp.  This
                   is intended to allow automatic updating of NIS database
                   files.  If separate passwd and group files are being used
                   by NIS, then use the -y path option to specify the location
                   of the NIS passwd database so that pw will concurrently
                   update it with the system password databases.
 
Just tried:

pw mod user TestUser -Y -y master.passwd -h 0

pw mod user TestUser -Y -y ./master.passwd -h 0

pw mod user TestUser -Y -y /var/yp/master.passwd -h 0

pw mod user TestUser -Y -y /var/yp/ -h 0

And all return the same end result... pw: no such user `TestUser'
 
Not sure if you're doing this on the NIS server itself. As far as I understood it you can't run this 'remotely', it has to be done 'locally', i.e. on the NIS server itself.
 
Back
Top