[{"data":1,"prerenderedAt":754},["ShallowReactive",2],{"navigation":3,"\u002Fblog\u002Fssh-key-authentication-setup":46,"\u002Fblog\u002Fssh-key-authentication-setup-surround":749},[4],{"title":5,"path":6,"stem":7,"children":8,"page":45},"Blog","\u002Fblog","blog",[9,13,17,21,25,29,33,37,41],{"title":10,"path":11,"stem":12},"吉布斯自由能、化学势与扩散势","\u002Fblog\u002Fchemical-potential-and-diffusion-potential","blog\u002Fchemical-potential-and-diffusion-potential",{"title":14,"path":15,"stem":16},"Deploying Nuxt Static Sites with Nginx","\u002Fblog\u002Fdeploying-nuxt-static-site-with-nginx","blog\u002Fdeploying-nuxt-static-site-with-nginx",{"title":18,"path":19,"stem":20},"相变驱动力计算","\u002Fblog\u002Fphase-transformation-driving-force","blog\u002Fphase-transformation-driving-force",{"title":22,"path":23,"stem":24},"Python 环境配置完全指南：Conda 与国内镜像源","\u002Fblog\u002Fpython-environment-setup-guide","blog\u002Fpython-environment-setup-guide",{"title":26,"path":27,"stem":28},"Rust 编译与配置指南","\u002Fblog\u002Frust-compilation-and-configuration","blog\u002Frust-compilation-and-configuration",{"title":30,"path":31,"stem":32},"SSH Key Authentication Setup Guide","\u002Fblog\u002Fssh-key-authentication-setup","blog\u002Fssh-key-authentication-setup",{"title":34,"path":35,"stem":36},"Tauri + Rust 技术栈与编译说明","\u002Fblog\u002Ftauri-rust-tech-stack-and-build","blog\u002Ftauri-rust-tech-stack-and-build",{"title":38,"path":39,"stem":40},"Complete Guide to Utoipa Integration with Axum","\u002Fblog\u002Futoipa-integration-with-axum","blog\u002Futoipa-integration-with-axum",{"title":42,"path":43,"stem":44},"Rust: Code Once, Build Anywhere","\u002Fblog\u002Fwhy-rust-priority","blog\u002Fwhy-rust-priority",false,{"id":47,"title":30,"author":48,"body":52,"date":742,"description":743,"extension":744,"image":745,"meta":746,"minRead":337,"navigation":327,"path":31,"seo":747,"stem":32,"__hash__":748},"blog\u002Fblog\u002Fssh-key-authentication-setup.md",{"name":49,"avatar":50},"Jing Zhong",{"src":51,"alt":49},"https:\u002F\u002Fppm-sources.oss-cn-hongkong.aliyuncs.com\u002Fzj\u002Fme.jpg",{"type":53,"value":54,"toc":726},"minimark",[55,59,64,71,75,80,83,121,127,146,150,153,166,171,185,190,219,223,226,238,241,245,250,270,275,298,302,305,375,379,471,475,480,543,548,574,579,601,605,609,616,679,682,701,705,708,722],[56,57,58],"p",{},"SSH key authentication provides a secure and convenient way to access remote servers without entering passwords each time. This guide will walk you through the quick setup process.",[60,61,63],"h2",{"id":62},"objective","Objective",[56,65,66,67],{},"Configure SSH key authentication to enable passwordless login to remote server ",[68,69,70],"code",{},"user@203.0.113.42",[60,72,74],{"id":73},"quick-configuration-steps","Quick Configuration Steps",[76,77,79],"h3",{"id":78},"_1-generate-key-pair","1. Generate Key Pair",[56,81,82],{},"Generate a new SSH key pair using ED25519 algorithm (recommended) or RSA:",[84,85,90],"pre",{"className":86,"code":87,"language":88,"meta":89,"style":89},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","ssh-keygen -t ed25519 -C \"your_email@example.com\"\n","bash","",[68,91,92],{"__ignoreMap":89},[93,94,97,101,105,108,111,115,118],"span",{"class":95,"line":96},"line",1,[93,98,100],{"class":99},"sBMFI","ssh-keygen",[93,102,104],{"class":103},"sfazB"," -t",[93,106,107],{"class":103}," ed25519",[93,109,110],{"class":103}," -C",[93,112,114],{"class":113},"sMK4o"," \"",[93,116,117],{"class":103},"your_email@example.com",[93,119,120],{"class":113},"\"\n",[56,122,123],{},[124,125,126],"strong",{},"Options:",[128,129,130,137,140],"ul",{},[131,132,133,134],"li",{},"Use default path: ",[68,135,136],{},"~\u002F.ssh\u002Fid_ed25519",[131,138,139],{},"Passphrase is optional (leave empty for complete passwordless login)",[131,141,142,143],{},"For RSA keys: ",[68,144,145],{},"ssh-keygen -t rsa -b 4096 -C \"your_email@example.com\"",[76,147,149],{"id":148},"_2-upload-public-key-to-remote-server","2. Upload Public Key to Remote Server",[56,151,152],{},"Copy your public key to the remote server:",[84,154,156],{"className":86,"code":155,"language":88,"meta":89,"style":89},"ssh-copy-id user@203.0.113.42\n",[68,157,158],{"__ignoreMap":89},[93,159,160,163],{"class":95,"line":96},[93,161,162],{"class":99},"ssh-copy-id",[93,164,165],{"class":103}," user@203.0.113.42\n",[56,167,168],{},[124,169,170],{},"What happens:",[128,172,173,176,182],{},[131,174,175],{},"Enter password once for the initial connection",[131,177,178,179],{},"Automatically configures ",[68,180,181],{},"~\u002F.ssh\u002Fauthorized_keys",[131,183,184],{},"Sets correct permissions (700 for .ssh directory, 600 for authorized_keys)",[56,186,187],{},[124,188,189],{},"Alternative method (if ssh-copy-id is not available):",[84,191,193],{"className":86,"code":192,"language":88,"meta":89,"style":89},"cat ~\u002F.ssh\u002Fid_ed25519.pub | ssh user@203.0.113.42 \"mkdir -p ~\u002F.ssh && chmod 700 ~\u002F.ssh && cat >> ~\u002F.ssh\u002Fauthorized_keys && chmod 600 ~\u002F.ssh\u002Fauthorized_keys\"\n",[68,194,195],{"__ignoreMap":89},[93,196,197,200,203,206,209,212,214,217],{"class":95,"line":96},[93,198,199],{"class":99},"cat",[93,201,202],{"class":103}," ~\u002F.ssh\u002Fid_ed25519.pub",[93,204,205],{"class":113}," |",[93,207,208],{"class":99}," ssh",[93,210,211],{"class":103}," user@203.0.113.42",[93,213,114],{"class":113},[93,215,216],{"class":103},"mkdir -p ~\u002F.ssh && chmod 700 ~\u002F.ssh && cat >> ~\u002F.ssh\u002Fauthorized_keys && chmod 600 ~\u002F.ssh\u002Fauthorized_keys",[93,218,120],{"class":113},[76,220,222],{"id":221},"_3-verify-passwordless-login","3. Verify Passwordless Login",[56,224,225],{},"Test the configuration:",[84,227,229],{"className":86,"code":228,"language":88,"meta":89,"style":89},"ssh user@203.0.113.42\n",[68,230,231],{"__ignoreMap":89},[93,232,233,236],{"class":95,"line":96},[93,234,235],{"class":99},"ssh",[93,237,165],{"class":103},[56,239,240],{},"You should now be logged in without entering a password!",[60,242,244],{"id":243},"understanding-ssh-keys","Understanding SSH Keys",[56,246,247],{},[124,248,249],{},"Private Key:",[128,251,252,257,260,267],{},[131,253,254,255],{},"Location: ",[68,256,136],{},[131,258,259],{},"Purpose: Authentication credential, must be kept secret",[131,261,262,263,266],{},"Permissions: Should be ",[68,264,265],{},"600"," (read\u002Fwrite for owner only)",[131,268,269],{},"NEVER share this file",[56,271,272],{},[124,273,274],{},"Public Key:",[128,276,277,282,285,292],{},[131,278,254,279],{},[68,280,281],{},"~\u002F.ssh\u002Fid_ed25519.pub",[131,283,284],{},"Purpose: Can be freely shared and placed on servers",[131,286,287,288,291],{},"Permissions: Can be ",[68,289,290],{},"644"," (readable by others)",[131,293,294,295,297],{},"Added to ",[68,296,181],{}," on remote server",[60,299,301],{"id":300},"usage-in-deployment-scripts","Usage in Deployment Scripts",[56,303,304],{},"After configuration, your deployment scripts can run without password prompts:",[84,306,308],{"className":86,"code":307,"language":88,"meta":89,"style":89},"#!\u002Fbin\u002Fbash\n# scripts\u002Fdeploy.sh\n\n# Now you can execute commands without password prompts\nssh user@203.0.113.42 \"cd \u002Fvar\u002Fwww\u002Fapp && git pull && npm install && npm run build\"\n\n# Or copy files without password\nscp -r .\u002Fdist user@203.0.113.42:\u002Fvar\u002Fwww\u002Fapp\u002F\n",[68,309,310,316,322,329,335,349,354,360],{"__ignoreMap":89},[93,311,312],{"class":95,"line":96},[93,313,315],{"class":314},"sHwdD","#!\u002Fbin\u002Fbash\n",[93,317,319],{"class":95,"line":318},2,[93,320,321],{"class":314},"# scripts\u002Fdeploy.sh\n",[93,323,325],{"class":95,"line":324},3,[93,326,328],{"emptyLinePlaceholder":327},true,"\n",[93,330,332],{"class":95,"line":331},4,[93,333,334],{"class":314},"# Now you can execute commands without password prompts\n",[93,336,338,340,342,344,347],{"class":95,"line":337},5,[93,339,235],{"class":99},[93,341,211],{"class":103},[93,343,114],{"class":113},[93,345,346],{"class":103},"cd \u002Fvar\u002Fwww\u002Fapp && git pull && npm install && npm run build",[93,348,120],{"class":113},[93,350,352],{"class":95,"line":351},6,[93,353,328],{"emptyLinePlaceholder":327},[93,355,357],{"class":95,"line":356},7,[93,358,359],{"class":314},"# Or copy files without password\n",[93,361,363,366,369,372],{"class":95,"line":362},8,[93,364,365],{"class":99},"scp",[93,367,368],{"class":103}," -r",[93,370,371],{"class":103}," .\u002Fdist",[93,373,374],{"class":103}," user@203.0.113.42:\u002Fvar\u002Fwww\u002Fapp\u002F\n",[60,376,378],{"id":377},"security-best-practices","Security Best Practices",[380,381,382,388,398,404,428,434],"ol",{},[131,383,384,387],{},[124,385,386],{},"Use a passphrase"," for your private key (optional but recommended)",[131,389,390,393,394,397],{},[124,391,392],{},"Never share your private key"," (",[68,395,396],{},"id_ed25519",")",[131,399,400,403],{},[124,401,402],{},"Use different keys"," for different services",[131,405,406,409,410],{},[124,407,408],{},"Disable password authentication"," on the server after setting up keys:\n",[84,411,413],{"className":86,"code":412,"language":88,"meta":89,"style":89},"# Edit \u002Fetc\u002Fssh\u002Fsshd_config\nPasswordAuthentication no\n",[68,414,415,420],{"__ignoreMap":89},[93,416,417],{"class":95,"line":96},[93,418,419],{"class":314},"# Edit \u002Fetc\u002Fssh\u002Fsshd_config\n",[93,421,422,425],{"class":95,"line":318},[93,423,424],{"class":99},"PasswordAuthentication",[93,426,427],{"class":103}," no\n",[131,429,430,433],{},[124,431,432],{},"Regularly rotate keys"," for critical systems",[131,435,436,439,440],{},[124,437,438],{},"Use SSH agent"," to manage keys:\n",[84,441,443],{"className":86,"code":442,"language":88,"meta":89,"style":89},"eval \"$(ssh-agent -s)\"\nssh-add ~\u002F.ssh\u002Fid_ed25519\n",[68,444,445,463],{"__ignoreMap":89},[93,446,447,451,454,457,460],{"class":95,"line":96},[93,448,450],{"class":449},"s2Zo4","eval",[93,452,453],{"class":113}," \"$(",[93,455,456],{"class":99},"ssh-agent",[93,458,459],{"class":103}," -s",[93,461,462],{"class":113},")\"\n",[93,464,465,468],{"class":95,"line":318},[93,466,467],{"class":99},"ssh-add",[93,469,470],{"class":103}," ~\u002F.ssh\u002Fid_ed25519\n",[60,472,474],{"id":473},"troubleshooting","Troubleshooting",[56,476,477],{},[124,478,479],{},"Permission denied error:",[84,481,483],{"className":86,"code":482,"language":88,"meta":89,"style":89},"# Fix permissions on local machine\nchmod 700 ~\u002F.ssh\nchmod 600 ~\u002F.ssh\u002Fid_ed25519\nchmod 644 ~\u002F.ssh\u002Fid_ed25519.pub\n\n# Fix permissions on remote server\nssh user@203.0.113.42 \"chmod 700 ~\u002F.ssh && chmod 600 ~\u002F.ssh\u002Fauthorized_keys\"\n",[68,484,485,490,502,511,521,525,530],{"__ignoreMap":89},[93,486,487],{"class":95,"line":96},[93,488,489],{"class":314},"# Fix permissions on local machine\n",[93,491,492,495,499],{"class":95,"line":318},[93,493,494],{"class":99},"chmod",[93,496,498],{"class":497},"sbssI"," 700",[93,500,501],{"class":103}," ~\u002F.ssh\n",[93,503,504,506,509],{"class":95,"line":324},[93,505,494],{"class":99},[93,507,508],{"class":497}," 600",[93,510,470],{"class":103},[93,512,513,515,518],{"class":95,"line":331},[93,514,494],{"class":99},[93,516,517],{"class":497}," 644",[93,519,520],{"class":103}," ~\u002F.ssh\u002Fid_ed25519.pub\n",[93,522,523],{"class":95,"line":337},[93,524,328],{"emptyLinePlaceholder":327},[93,526,527],{"class":95,"line":351},[93,528,529],{"class":314},"# Fix permissions on remote server\n",[93,531,532,534,536,538,541],{"class":95,"line":356},[93,533,235],{"class":99},[93,535,211],{"class":103},[93,537,114],{"class":113},[93,539,540],{"class":103},"chmod 700 ~\u002F.ssh && chmod 600 ~\u002F.ssh\u002Fauthorized_keys",[93,542,120],{"class":113},[56,544,545],{},[124,546,547],{},"Still asks for password:",[128,549,550,555,561,568],{},[131,551,552,553,297],{},"Verify public key is in ",[68,554,181],{},[131,556,557,558],{},"Check SSH server configuration: ",[68,559,560],{},"\u002Fetc\u002Fssh\u002Fsshd_config",[131,562,563,564,567],{},"Ensure ",[68,565,566],{},"PubkeyAuthentication yes"," is set",[131,569,570,571],{},"Restart SSH service: ",[68,572,573],{},"sudo systemctl restart sshd",[56,575,576],{},[124,577,578],{},"Multiple keys:",[84,580,582],{"className":86,"code":581,"language":88,"meta":89,"style":89},"# Specify which key to use\nssh -i ~\u002F.ssh\u002Fspecific_key user@203.0.113.42\n",[68,583,584,589],{"__ignoreMap":89},[93,585,586],{"class":95,"line":96},[93,587,588],{"class":314},"# Specify which key to use\n",[93,590,591,593,596,599],{"class":95,"line":318},[93,592,235],{"class":99},[93,594,595],{"class":103}," -i",[93,597,598],{"class":103}," ~\u002F.ssh\u002Fspecific_key",[93,600,165],{"class":103},[60,602,604],{"id":603},"advanced-configuration","Advanced Configuration",[76,606,608],{"id":607},"ssh-config-file","SSH Config File",[56,610,611,612,615],{},"Create ",[68,613,614],{},"~\u002F.ssh\u002Fconfig"," for easier connections:",[84,617,620],{"className":618,"code":619,"language":235,"meta":89,"style":89},"language-ssh shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","Host myserver\n    HostName 203.0.113.42\n    User user\n    IdentityFile ~\u002F.ssh\u002Fid_ed25519\n    Port 22\n\nHost production\n    HostName 198.51.100.17\n    User deploy\n    IdentityFile ~\u002F.ssh\u002Fwork_key\n    Port 2222\n",[68,621,622,627,632,637,642,647,651,656,661,667,673],{"__ignoreMap":89},[93,623,624],{"class":95,"line":96},[93,625,626],{},"Host myserver\n",[93,628,629],{"class":95,"line":318},[93,630,631],{},"    HostName 203.0.113.42\n",[93,633,634],{"class":95,"line":324},[93,635,636],{},"    User user\n",[93,638,639],{"class":95,"line":331},[93,640,641],{},"    IdentityFile ~\u002F.ssh\u002Fid_ed25519\n",[93,643,644],{"class":95,"line":337},[93,645,646],{},"    Port 22\n",[93,648,649],{"class":95,"line":351},[93,650,328],{"emptyLinePlaceholder":327},[93,652,653],{"class":95,"line":356},[93,654,655],{},"Host production\n",[93,657,658],{"class":95,"line":362},[93,659,660],{},"    HostName 198.51.100.17\n",[93,662,664],{"class":95,"line":663},9,[93,665,666],{},"    User deploy\n",[93,668,670],{"class":95,"line":669},10,[93,671,672],{},"    IdentityFile ~\u002F.ssh\u002Fwork_key\n",[93,674,676],{"class":95,"line":675},11,[93,677,678],{},"    Port 2222\n",[56,680,681],{},"Now you can connect with:",[84,683,685],{"className":86,"code":684,"language":88,"meta":89,"style":89},"ssh myserver\nssh production\n",[68,686,687,694],{"__ignoreMap":89},[93,688,689,691],{"class":95,"line":96},[93,690,235],{"class":99},[93,692,693],{"class":103}," myserver\n",[93,695,696,698],{"class":95,"line":318},[93,697,235],{"class":99},[93,699,700],{"class":103}," production\n",[60,702,704],{"id":703},"conclusion","Conclusion",[56,706,707],{},"SSH key authentication provides:",[128,709,710,713,716,719],{},[131,711,712],{},"✅ Enhanced security (cryptographic authentication)",[131,714,715],{},"✅ Convenience (no password typing)",[131,717,718],{},"✅ Automation support (scripts, CI\u002FCD)",[131,720,721],{},"✅ Single sign-on experience (with SSH agent)",[723,724,725],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}",{"title":89,"searchDepth":318,"depth":318,"links":727},[728,729,734,735,736,737,738,741],{"id":62,"depth":318,"text":63},{"id":73,"depth":318,"text":74,"children":730},[731,732,733],{"id":78,"depth":324,"text":79},{"id":148,"depth":324,"text":149},{"id":221,"depth":324,"text":222},{"id":243,"depth":318,"text":244},{"id":300,"depth":318,"text":301},{"id":377,"depth":318,"text":378},{"id":473,"depth":318,"text":474},{"id":603,"depth":318,"text":604,"children":739},[740],{"id":607,"depth":324,"text":608},{"id":703,"depth":318,"text":704},"2025-01-04","Learn how to configure SSH key authentication for passwordless remote server login with quick and easy steps.","md","https:\u002F\u002Fppm-sources.oss-cn-hongkong.aliyuncs.com\u002Fzj\u002F3rd\u002Fssh.png",{},{"title":30,"description":743},"n__8R9u4Qho7yxoHUzRVvPoWZ25jgJBCJogk820QI6A",[750,752],{"title":26,"path":27,"stem":28,"description":751,"children":-1},"介绍Rust的编译配置、镜像源设置和常见编译场景，包括musl编译、示例运行和镜像加速配置。",{"title":34,"path":35,"stem":36,"description":753,"children":-1},"以 csv_editor_app 为例，说明基于 Tauri 2 + Rust + React + Vite + TypeScript 的桌面应用开发环境、编译流程与技术栈。",1792686186311]