Some notes for setting up SSH connection to a remote computer.
The most straightforward way is apparently
For frequent access, it would be nice to create an alias in the .bashrc file,
Naive connection to host would require the password of username. So a better way is to setup the public key authentication, i.e. a security key pair on the local and the remote computers.
The steps are simple. First, run ssh-keygen to generate the private and the public keys using the specified algorithm, which by default is the RSA. Then, the public key needs to be copied to the host and installed in the authorized_keys file. One can either do it manually, or using a handy tool,
Finally, scp can be used to transfer files to and from the host. The usage is just like the cp command,
Again, for frequent access to a particular host, it would be nice to avoid user@host in the scp command. Something like below is expected,
The myscp command can be implemented as follows,
And the scpwrapper function is defined as,
References: