Since Mac OS is very similar to UNIX-based operating system terminals and Linux, it is not possible to remotely log on to a Linux server without the use of Windows-like putty and CRT tools, requiring a simple 3-step password-free SSH remote.
1: Generate the key. Under Mac Terminal, execute the following command:
SSH-KEYGEN-T RSA
The default is to press ENTER on the line, do not have to make other changes, after execution will generate two files, a public key, a private key.
LS ~/.ssh
#id_rsa (private key) id_rsa.pub (public key)
2: Place the public key to the server that needs to be remote.
SCP ~/.ssh/id_rsa.pub User @:/home/user/.ssh/, or can be copied to/root/.ssh
3: Log on to the remote server
CD ~/.ssh
CAT/user root/.ssh/id_rsa.pub >> authorized_keys #将公钥内容加入到authorized_keys文件, no, just create one.
In addition to using the Mac OSX Terminal SSH command to connect to the server, if a period of inactivity, you will be logged out and the following error message appears:
Write Failed:broken Pipe
The SSH command can only be used to connect again.
Workaround
Method One: $ ssh-o serveraliveinterval=60 [email protected]
Method Two: Simply add the following configuration to the server's/etc/ssh/sshd_config:
Add or modify Clientaliveinterval to "Clientaliveinterval 60". This parameter means that every 1 minutes, the server sends a message to the client to keep the connection. Remember to restart the SSH service after saving.
Mac password-Free login server