In the previous article, you can already enter from the Mac terminal.
$ sudo apt update
Every time. I will never forget this.
$ ssh-keygen -t rsa -f arbitrary name
Specify password.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Check below
$ ls
Any name: private key Any name.pub: Public key
The rest is Mac /Users/username/.ssh/private key Copy the contents to and save.
Then do the following:
$cat arbitrary name.pub >> authorized_keys
Change permissions.
$ chmod 600 authorized_keys
$ chmod 700 /home/account name/.ssh
Delete original public key
rm -f arbitrary name.pub
Delete private key
$rm any name
/etc/ssh/sshd_config Add (or uncomment) the following to.
+ChallengeResponseAuthentication no
+PubkeyAuthentication yes
sshd restart
$ sudo /etc/init.d/ssh restart
Create /Users/accountname/.ssh/config for Mac
Host account name
HostName IP address
User account name
IdentityFile /Users/account name/.ssh/account name
Port Port number
with this,
$ssh account name
Put in
Password authentication is still possible at this point, so add (or uncomment) the following
+PasswordAuthentication no
Well then
$ssh account name
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
・ ・ ・ ・ ・ ・ ・ ・ ・
Oops ... It looks like you have to change the permissions on your Mac.
$ chmod 0600 ~/.ssh/
Then, once again.
Enter passphrase for key ‘・ ・ ・ ・ ・ ・
Now enter with the password you entered when creating the key.
By the way, it seems that the password for the ssh key cannot be saved with config.
Recommended Posts