ssh command does not exit when X11 forwarding is enabled
If ForwadX11 and ForwardX11Trusted are both enabled in /etc/ssh/ssh_config, when you do “ssh host” it will invoke X11 forwarding by default. This is convenient when you frequently need to run programs with GUI on remote host. However, with X11 forwarding, if you are simply running a text mode command/script via ssh, like “ssh node ls” to list files on a remote host, it may not exit properly with X11 forwarding.
To avoid this, the simplest way is to disable X11 forwarding in the ssh command using -x option: using “ssh -x node command” instead of “ssh node command”.