[Configuration] Mac configuration ssh

configure ssh

https://zhidao.baidu.com/question/688766784553274084.html

However, a password is required every time, and a manual reconnection is required when the connection is timed out. Reconnection.
The first is to save the password input problem, you need to create a key, enter on your command line:
local:~ yourname$ ssh-keygen -t rsa
and press Enter in turn, enter the password, this password has nothing to do with the SSH account password.
The whole interface looks similar:
local:~ yourname$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/u/kim/.ssh/id_rsa): [Enter]
Enter passphrase (empty for no passphrase): 【First passphrase】
Enter same passphrase again: 【Second passphrase】
Your identification has been saved in /u/kim/.ssh/id_rsa.
Your public key has been saved in /u /kim/.ssh/id_rsa.pub.
Then transfer the key file to your SSH account:
local:~ yourname$ cd ~/.ssh
local:~ yourname$ cp id_rsa.pub authorized_keys
local:~ yourname$ scp -p ~/.ssh/authorized_keys hrothgar:.ssh/
The last step will prompt you to enter the password of the SSH account, not the password you just created the key.
If the last step prompts an error, it is usually because of a remote permission problem.
You need to log in to the remote machine as root, create a relevant directory for this SSH account, and set permissions:
set in the Home directory of the SSH account login:

According to the above statement

image-20220321101657361

image-20220321101446106

After opening this file

image-20220321101515958

image-20220321102122779

Last login: Thu Mar 17 15:24:22 on ttys000
(base) liuxinny@Xinny-MBP ~ % ssh-keygen -t rsa        
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/liuxinny/.ssh/id_rsa): 
/Users/liuxinny/.ssh/id_rsa already exists.
Overwrite (y/n)? %                                                              (base) liuxinny@Xinny-MBP ~ % open /Users/liuxinny/.ssh/id_rsa
(base) liuxinny@Xinny-MBP ~ % open /Users/liuxinny/.ssh/id_rsa
(base) liuxinny@Xinny-MBP ~ % ssh-keygen -t rsa               
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/liuxinny/.ssh/id_rsa): 
/Users/liuxinny/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /Users/liuxinny/.ssh/id_rsa.
Your public key has been saved in /Users/liuxinny/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:9xvoOW0/18GB0uAHT756RM0TmjKf3GRMKDQ12iamVXg [email protected]
The key's randomart image is:
+---[RSA 3072]----+
|          .oo+.  |
|           ==E.o |
|          .=XoO .|
|          +=oX O |
|        S.. O B o|
|         . o * + |
|          ..=   o|
|         ..oo+. o|
|          ooo..o |
+----[SHA256]-----+
(base) liuxinny@Xinny-MBP ~ % open /Users/liuxinny/.ssh/id_rsa
(base) liuxinny@Xinny-MBP ~ % cat c/User/username/.ssh/id_rsa.pub
cat: c/User/username/.ssh/id_rsa.pub: No such file or directory
(base) liuxinny@Xinny-MBP ~ % cat /Users/liuxinny/.ssh/id_rsa
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABD1ASrUWi
WMEJVuXPwIBk5EAAAAEAAAAAEAAAGXAAAAB3NzaC1yc2EAAAADAQABAAABgQCkkk/nkjgG
L9OCa1AJZkKDXG/TrskhnlAkPStyHkpj5jwo5ed+DOw+rxjwXq/YD0NFkht7bTBkRQC75Q
E3LvWOzmUXS/IKKZylM1KUAnkoOFbdcQ7AsPZcD3t/ciWNGhAK9qnEfWi4beonvCdoJrEZ
9hwJl5w5KBSjVv1W7YVeJH5/lQ9Vob3ZqqgVyEiQy0mL6GK/GzPyLu/wy5jNvO/OrEuaoJ
Xnetjk4DO//p1R8+bnbQ7eQaGo3c7u3aZZNORr9OwVqD4DxN+4VaxQsHRPz5aFah0X3Yux
cQepPiaRqDo1R8BaT9oViqpselgy3FEW5HctsjxrdpMf15V+DkgbG/7GVPt0Hi29av/svJ
ymRAFxUjlbn92HIlrsjK5OQqb7ZV+wtFncWbUZb878ML47LBYfPIfSsjRMPholOEiGK26o
cz9wJJa/d4Rixu5RuTzQIdn3DClNktJSvLx/k+quEbVRqrZ595J2LME88wfmKXyPFyHulH
oj4yucs45mpdUAAAWQs2giSQBT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8jaPeN1uBqcb4hRiLa61ZPMFb
5ZuvqHJ4MVQPTlH9dAtvclIP99POXoRu1vueroyynqDAUmGzWcbxMd8+QO88Seaj85jBbo
6YL+wSz5h6lxehrzPiQCBZFnnibEBf3/hP3FQNH72TWW1DGJZXkTKy9mbYrBzZLMVImiqx
FKFJx3WwFYNWxFTHqmUob1b9vU/s5QNqdapoDt3G0+TZCxxzBXX4KNeLc+j41c5+oi3cPR
NMK/BwdxKoPVOMOxUeZRhUtzqFrnKqjsZkvY+iXIU0DzNhQLr4p5u/5OTihVOtGUrA1i1w
51aXLE5/y9Jr9V/GZzdRab6qpcLnsgkV8ZGW6EMYiV36d3++5qPsz2uy9mvJgYsYiijVTf
7f5O3bk4GziumrwQrXTQStSE9zmk0fzkcLoZzAuI3Sw2xCDenURDM2vhH1OEQWb+3/RtC1
Yx63QPGeq32EzqOdKGqLJtvZ6RfNa/glyn2VyWK6DlwikHW9eg8H3v7hrpYKK1dnLpD0XW
2uh45l473GmSS3NYKU+pbLnRd6JdQLuXWqJ04/euXwGWaRpEOPg2ORsyNvcfmgiD4WdQ2V
LQMv1k4Cp/lustcIJIse1eKAwai2Ncr4idLURkNi0jhR8ua1/fpIas3YH1G2/vrkrRyVUj
eJ6+1xh2kAuFHSK16lF4X/MWSwBMq70/Twcliijgex8+nuPaoivGnG9x/xugg4ulTsvPzM
onk4X88/CmjnBnsjnP5jT/nrD8IGsSHPZfVsVDImE3CHDz7llxPNmcXJLy4ySmdLevktt8
ItN1BRYGMiwxvUrgvD+oEapPJrk=
-----END OPENSSH PRIVATE KEY-----
(base) liuxinny@Xinny-MBP ~ % 

Guess you like

Origin blog.csdn.net/CeciliaXinn/article/details/123629451