User info gathering for remote server


need to gathering user info date wise.

dtStr=date +%d-%B-%y
file = “/etc/passwd”
while read -r line
UserName=echo $line | cut -d: -f1
echo “$hostName,$UserName,$dtStr”
done < “/etc/passwd”

above command able to get info but from remote machine how to capture.
remote machine to client server having password less.


can any one help me on this. need to compare the data date wise.


Hi @Ritesh

Using ssh you can execute local script on remote machine

The basic syntax for

#ssh user@remote-machine /path/to/script 

you can also use arguments

#ssh user@remote-machine /path/to/script arg1 arg2