• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

SSH scripting question

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:
Code:
cat /tmp/users.lst | ssh user@server "while read username; do getent passwd $username >> /shared/folder/passwd.tmp; done"
and
Code:
ssh user@server "while read username; do getent passwd $username >> /shared/folder/passwd.tmp; done </shared/folder/users.lst"
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?
 
I found where my problem was. I was using double quotes (") instead of single quotes(') for the ssh command. This caused the client shell to interpret the $username and then pass run it in ssh. I stupidly forgot about this...
 
Back
Top