Easy Tutorial
❮ Htmlcss Make A Website Builder Pattern 2 ❯

Mac OS SSH Login with PEM File

Category Programming Techniques

First, modify the permissions of the PEM file:

sudo chmod 600 key.pem

The command to connect to the server using a PEM file on Mac OS is as follows:

ssh -i key.pem root@IP

You can also use ssh-add to add the key file:

ssh-add -k key.pem

Then you can log in normally:

ssh root@IP

In addition, we often encounter disconnection issues during use, which can be resolved by modifying the following configurations.

Log in to the server:

vim /etc/ssh/sshd_config

Find the following two lines:

ClientAliveInterval 0
ClientAliveCountMax 3

Remove the comments and change to:

ClientAliveInterval 30 
ClientAliveCountMax 86400

The meanings of these two lines are:

Restart the sshd service:

service sshd restart

** Click to Share Notes

Cancel

-

-

-

❮ Htmlcss Make A Website Builder Pattern 2 ❯