[{"data":1,"prerenderedAt":133},["ShallowReactive",2],{"post:ssh-key-permissions-must-be-exact":3},{"id":4,"title":5,"body":6,"date":122,"description":12,"draft":123,"extension":124,"meta":125,"navigation":126,"path":127,"seo":128,"stem":129,"tags":130,"__hash__":132},"posts\u002Fposts\u002Fssh-key-permissions-must-be-exact.md","TIL: SSH Key Permissions Must Be Exact!",{"type":7,"value":8,"toc":120},"minimark",[9,13,21,55,58,65,68,109,116],[10,11,12],"p",{},"So, I just re-installed Ubuntu on my dev machine. (18.04, whoop whoop!)",[10,14,15,16,20],{},"One of the steps I took to make it easier was creating a private repo with all my SSH keys in it, and backing it up to Bitbucket. When I attempted to reuse this repo, I kept getting a ",[17,18,19],"code",{},"refused"," error.",[22,23,28],"pre",{"className":24,"code":25,"language":26,"meta":27,"style":27},"language-bash shiki shiki-themes github-light github-dark","sign_and_send_pubkey: signing failed: agent refused operation\n","bash","",[17,29,30],{"__ignoreMap":27},[31,32,35,39,43,46,49,52],"span",{"class":33,"line":34},"line",1,[31,36,38],{"class":37},"sScJk","sign_and_send_pubkey:",[31,40,42],{"class":41},"sZZnC"," signing",[31,44,45],{"class":41}," failed:",[31,47,48],{"class":41}," agent",[31,50,51],{"class":41}," refused",[31,53,54],{"class":41}," operation\n",[10,56,57],{},"I eventually realized that the key files I'd copied back into place, as well as the SSH config file itself, must have certain read-only permissions applied or they will be ignored by the SSH service.",[10,59,60,61,64],{},"I quickly found this SO post which outlined the proper permissions: [SO: Permissions on Private Key in SSH Folder",[31,62,63],{},"1",". I would think it should be obvious that something as sensitive as SSH keys should be readable to only the owner. Yet, here I was!",[10,66,67],{},"The easy fix:",[22,69,71],{"className":24,"code":70,"language":26,"meta":27,"style":27},"$ chmod 600 ~\u002F.ssh\u002F*\n$ chmod 644 ~\u002F.ssh\u002F*.pub\n",[17,72,73,91],{"__ignoreMap":27},[31,74,75,78,81,85,88],{"class":33,"line":34},[31,76,77],{"class":37},"$",[31,79,80],{"class":41}," chmod",[31,82,84],{"class":83},"sj4cs"," 600",[31,86,87],{"class":41}," ~\u002F.ssh\u002F",[31,89,90],{"class":83},"*\n",[31,92,94,96,98,101,103,106],{"class":33,"line":93},2,[31,95,77],{"class":37},[31,97,80],{"class":41},[31,99,100],{"class":83}," 644",[31,102,87],{"class":41},[31,104,105],{"class":83},"*",[31,107,108],{"class":41},".pub\n",[10,110,111,112,115],{},"All set! Just to make sure, I ran ",[17,113,114],{},"ssh-add"," immediately after resolving the permissions.",[117,118,119],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}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 .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}",{"title":27,"searchDepth":93,"depth":93,"links":121},[],"2018-09-06T00:10:40-04:00",false,"md",{},true,"\u002Fposts\u002Fssh-key-permissions-must-be-exact",{"title":5,"description":12},"posts\u002Fssh-key-permissions-must-be-exact",[26,131],"til","XkwkTaGf7hltHq5WMyGctyZcr8CIcgwiP6cm_xqIuts",1790471528087]