There are two servers in LAN. There are number of users in both servers.
I am user of one server. If I want to change password of another user of my server (I have these privileges by root), I can do it easily.
But If I want to change password of other server's user, I use ssh.
I log into other server using ssh and I use sudo passwd username.
It asks me new password for the username and I can change it easily.
But i have to do this thing multiple times. i want to use shell script for this.
I have tried some combinations but it is not working.
I want when I will run the shell script, it should ask me "new password" that I will enter and "retype password" that I will enter again and password will be changed.
I don't want to login manually through ssh and manually enter the command
"sudo passwd username"
My shell scripts which are not working:-
ssh server-IP sudo passwd user
ssh server-IP 'sudo passwd user;'
It asks me server's password when I enter this, terminal disappears and nothing happens
ssh server-IP ; sudo passwd user
ssh server-IP; sudo passwd user
It ends on server's command prompt and does not execute the change passwd command.
ssh server-IP | sudo passwd user;
It is not working too. Please help