The following commands are only for Unix-like systems.
Windows does not need this solution. Many PuTTY-like tools on Windows can choose “remember password” to implement passwordless login.
I did not find a similar password-remembering solution on Mac, but using a key is actually a more secure method.