I need to run a command on the *client* machine immediately after making an ssh connection, is there any clever way to do this?
Specifically I want to execute an rsync command whenever I connect to certain systems, I have 'ControlMaster auto' set in my ssh config file so the rsync command will run without asking for a password/key.
Any ideas anyone?
I suppose one could alias the ssh and fire something off in the background with a wait before the actual ssh but this does seem a bit crude.
On Mon, Aug 06, 2018 at 11:45:07AM +0100, Chris Green wrote:
I need to run a command on the *client* machine immediately after making an ssh connection, is there any clever way to do this?
Specifically I want to execute an rsync command whenever I connect to certain systems, I have 'ControlMaster auto' set in my ssh config file so the rsync command will run without asking for a password/key.
Any ideas anyone?
Typical, I found the answer just after asking the question! Internet searches were nouse at all but reading stadily through the ssh_config man page finally got me to:-
LocalCommand Specifies a command to execute on the local machine after successfully connecting to the server.
Exactly what I need! :-)