title: Jenkins user ssh/config proxy not working, root user works
body: <p>I created a proxy setup for the ssh so that, <code>git clone</code> uses the http proxy also for SSH, this works when i run it on the machine terminal as root.</p>
  
  <p>However when I switch to the jenkins user I can no longer ssh to bitbucket through the proxy.</p>
  
  <p>How can I get git to clone repo using ssh-trust(private-public key) when I am using Jenkins user.</p>
  
  <p>It seems that the id_rsa works as expected. from <em>/var/lib/jenkins/.ssh</em></p>
  
  <p>(again, the proxy works from the commandline as root...)</p>
  
  <p><strong>To setup the proxy</strong> </p>
  
  <p>For root and jenkins alike I create in the corresponding home folder (/root and /var/lib/jenkins):</p>
  
  <p><strong>vi ~/.ssh/config</strong></p>
  
  <pre><code>Host bitbucket.org
    HostName altssh.bitbucket.org
    Port 443
    ProxyCommand ncat --proxy webproxy.ec.local:9090 %h %p
    IdentityFile /var/lib/jenkins/.ssh/id_rsa
  </code></pre>
  
  <p>Here is the log when the jenkins using attempts fails (i also tried with providing <code>-i /var/lib/jenkins/.ssh/id_rsa</code>)</p>
  
  <p><em>also: known_hosts is empty...</em></p>
  
  <pre><code>bash-4.2$ ssh bitbucket.org -v
  OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
  debug1: Reading configuration data /var/lib/jenkins/.ssh/config
  debug1: /var/lib/jenkins/.ssh/config line 1: Applying options for bitbucket.org
  debug1: Reading configuration data /etc/ssh/ssh_config
  debug1: /etc/ssh/ssh_config line 58: Applying options for *
  debug1: Executing proxy command: exec ncat --proxy webproxy.ec.local:9090 altssh.bitbucket.org 443
  debug1: permanently_drop_suid: 995
  
  debug1: key_load_public: No such file or directory
  debug1: identity file /var/lib/jenkins/.ssh/id_rsa type -1
  debug1: key_load_public: No such file or directory
  debug1: identity file /var/lib/jenkins/.ssh/id_rsa-cert type -1
  
  debug1: Enabling compatibility mode for protocol 2.0
  debug1: Local version string SSH-2.0-OpenSSH_7.4
  ssh_exchange_identification: Connection closed by remote host
  </code></pre>
  
  <p>When I run as root I get (where permanently_drop_suid: 995 was):</p>
  
  <pre><code>debug1: permanently_set_uid: 0/0
  debug1: permanently_drop_suid: 0
  </code></pre>
  
  <p>and the connection continues after <strong>Local version string SSH-2.0-OpenSSH_7.4</strong></p>
  
  <pre><code>debug1: Remote protocol version 2.0, remote software version conker_1.0.311-c6337e4 app-130
  debug1: no match: conker_1.0.311-c6337e4 app-130
  debug1: Authenticating to altssh.bitbucket.org:443 as 'root'
  debug1: SSH2_MSG_KEXINIT sent
  debug1: SSH2_MSG_KEXINIT received
  debug1: kex: algorithm: curve25519-sha256@libssh.org
  debug1: kex: host key algorithm: ssh-rsa
  debug1: kex: server-&gt;client cipher: aes128-ctr MAC: hmac-sha2-256-etm@openssh.com compression: none
  debug1: kex: client-&gt;server cipher: aes128-ctr MAC: hmac-sha2-256-etm@openssh.com compression: none
  debug1: kex: curve25519-sha256@libssh.org need=32 dh_need=32
  debug1: kex: curve25519-sha256@libssh.org need=32 dh_need=32
  debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
  </code></pre>
  
  <p>etc etc.</p>