SSH agent forwarding & screen

This commit is contained in:
Ian Gulliver
2019-04-15 01:25:50 +00:00
parent d7a51bdb50
commit 197f834ee2
4 changed files with 43 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
<!--# set var="title" value="SSH agent forwarding & screen" -->
<!--# set var="date" value="February 28, 2016" -->
<!--# include file="include/top.html" -->
<p>ssh-agent forwarding and screen not playing nicely is one of those things that Ive dealt with so long that it just became routine. Resume a screen from a previous connection? Outgoing SSH wont work, and thats just the way it is. One day this week, I finally decided to see if I can fix it, and fortunately the Internet <a href="https://gist.github.com/martijnvermaat/8070533">provides</a>. That doc has a bunch of complexity about X forwarding, which I havent cared about in years, so heres the distilled version. Youll need to have already <a href="https://developer.github.com/guides/using-ssh-agent-forwarding/">set up agent forwarding</a>. On the host with your screen session:</p>
<pre><code>tee ~/.ssh/rc &lt;&lt;'END'
if test "$SSH_AUTH_SOCK"; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
fi
END
tee -a ~/.screenrc &lt;&lt;END
setenv SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock
END
</code></pre>
<p>Reconnect, restart screen once, never worry about it again. Changing my life.</p>
<!--# include file="include/bottom.html" -->

View File

@@ -14,6 +14,7 @@
<li>2016-Mar-13: <a href="2016-03-13-raspbian-setup-notes.html">Raspbian setup notes</a></li>
<li>2016-Mar-02: <a href="2016-03-02-more_poll_epoll_fun.html">More poll()/epoll fun</a></li>
<li>2016-Mar-01: <a href="2016-03-01-asynchronous-name-resolution-in-c.html">Asynchronous name resolution in C</a></li>
<li>2016-Feb-28: <a href="2016-02-28-ssh-agent-forwarding-screen.html">SSH agent forwarding &amp; screen</a></li>
</ol>
<!--# include file="include/bottom.html" -->

View File

@@ -0,0 +1,20 @@
<!--# set var="title" value="SSH agent forwarding & screen" -->
<!--# set var="date" value="February 28, 2016" -->
<!--# include file="include/top.html" -->
ssh-agent forwarding and screen not playing nicely is one of those things that Ive dealt with so long that it just became routine. Resume a screen from a previous connection? Outgoing SSH wont work, and thats just the way it is. One day this week, I finally decided to see if I can fix it, and fortunately the Internet [provides](https://gist.github.com/martijnvermaat/8070533). That doc has a bunch of complexity about X forwarding, which I havent cared about in years, so heres the distilled version. Youll need to have already [set up agent forwarding](https://developer.github.com/guides/using-ssh-agent-forwarding/). On the host with your screen session:
tee ~/.ssh/rc <<'END'
if test "$SSH_AUTH_SOCK"; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
fi
END
tee -a ~/.screenrc <<END
setenv SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock
END
Reconnect, restart screen once, never worry about it again. Changing my life.
<!--# include file="include/bottom.html" -->

View File

@@ -13,5 +13,6 @@
1. 2016-Mar-13: [Raspbian setup notes](2016-03-13-raspbian-setup-notes.html)
1. 2016-Mar-02: [More poll()/epoll fun](2016-03-02-more_poll_epoll_fun.html)
1. 2016-Mar-01: [Asynchronous name resolution in C](2016-03-01-asynchronous-name-resolution-in-c.html)
1. 2016-Feb-28: [SSH agent forwarding & screen](2016-02-28-ssh-agent-forwarding-screen.html)
<!--# include file="include/bottom.html" -->