crazycaveman
n00b
- Joined
- Sep 20, 2008
- Messages
- 17
I'm trying to set up a script to update the passwd file nightly on a Linux machine for NIS. In order to do this, I have to get the details from a 2nd machine through SSH. I have tried running the following command to no avail:
and
However, it seems that the output of the cat command is not being piped over to the SSH session; the passwd.tmp file will be full of the "standard" users (root, ntp, etc.). I have tried putting the users.lst file on the shared folder and it still won't work. Would anyone have some idea on how to do this?
Code:
cat /tmp/users.lst | ssh user@server "while read username; do getent passwd $username >> /shared/folder/passwd.tmp; done"
Code:
ssh user@server "while read username; do getent passwd $username >> /shared/folder/passwd.tmp; done </shared/folder/users.lst"