Answers: <p>Check to see if the home directory for Jenkins was created?</p>
  
  <p><code>/home/jenkins</code></p>
  
Answers: CC BY-SA 4.0
Answers: 2019-03-14T08:51:21.567Z
Answers: No, there isn't any dir for that user, but on other VPS I don't have it either and works fine, in any case I created a dir jenkins in home, still the same issue.
Answers: Tatu Bogdan
Answers: CC BY-SA 4.0
Answers: 2019-03-14T15:52:46.037Z
Answers: Was asking because I had this same issue and creating the directory solved it.
Answers: VinDev
Answers: CC BY-SA 4.0
Answers: 2019-03-13T22:44:36.377Z
Answers: 2019-03-13T22:44:36.377Z
Answers: VinDev
Body: <p>I created a user for jenkins on my remote server that worked previously just fine, but now when I try to login with shh on the server the connection closes immediately after login. This is strange because on the website that is hosting jenkins it seem to work just fine, I can log there with chrome no problem and it evan builds succefully. My only problem is when I SSH with that user jenkins on the server.
  Will add here the ssh -v logs when I get disconnected:</p>
  
  <pre><code>debug1: client_input_channel_req: channel 0 rtype exit-signal reply 0
  debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
  Last login: Tue Mar 12 09:21:23 2019 from 82.78.220.8
  debug1: channel 0: free: client-session, nchannels 1
  Connection to 145.239.84.136 closed.
  Transferred: sent 2652, received 3604 bytes, in 0.5 seconds
  Bytes per second: sent 5268.4, received 7159.7
  debug1: Exit status -1
  </code></pre>
  
  <p>This is what I get after I insert the password. </p>
  
  <p>I will also post the sshd logs:</p>
  
  <pre><code>Accepted password for jenkins from 82.78.220.8 port 40872 ssh2
  pam_unix(sshd:session): session opened for user jenkins by (uid=0)
  Received disconnect from 82.78.220.8 port 40872:11: disconnected by user
  Disconnected from 82.78.220.8 port 40872
  pam_unix(sshd:session): session closed for user jenkins
  </code></pre>
  
  <p>I have this setup in the passwd:</p>
  
  <pre><code>jenkins:x:113:118:Jenkins,,,:/var/lib/jenkins:/bin/bash
  </code></pre>
  
  <p>I have to add that I can ssh with other users on the server just fine.
  I also tryed to <strong>su jenkins</strong> from root: This will just freeze my terminal and will open something like this:</p>
  
  <pre><code>jenkins@vps531680:/root$ root@vps531680:~# root@vps531680:~# logout
  </code></pre>
  
  <p>and I will get disconnected.</p>
  
  <p>I also tryed this <strong>sudo usermod -s /bin/bash jenkins</strong>:</p>
  
  <pre><code>bash: /root/.bashrc: Permission denied
  jenkins@vps531680:~$ Killed
  </code></pre>
  
  <p>On the weird side is that if I just reboot the server, for like 5-10 mins after that my jenkins user works just fine, but I will get disconnected after that time and I won't be able to SSH again, only after another reboot and for 5-10 mins. Any advice will be apreciated!</p>
  
Tags: <jenkins><servers>
Title: Jenkins SSH connection on remote server immediately closes after login
UserDisplayName: Tatu Bogdan
ThreadText: # Jenkins SSH connection on remote server immediately closes after login
  
  (Asked by: username_0 on 2019-03-12)
  
  I created a user for jenkins on my remote server that worked previously just fine, but now when I try to login with shh on the server the connection closes immediately after login. This is strange because on the website that is hosting jenkins it seem to work just fine, I can log there with chrome no problem and it evan builds succefully. My only problem is when I SSH with that user jenkins on the server.
  Will add here the ssh -v logs when I get disconnected:
  
  ```
  debug1: client_input_channel_req: channel 0 rtype exit-signal reply 0
  debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
  Last login: Tue Mar 12 09:21:23 2019 from 82.78.220.8
  debug1: channel 0: free: client-session, nchannels 1
  Connection to 145.239.84.136 closed.
  Transferred: sent 2652, received 3604 bytes, in 0.5 seconds
  Bytes per second: sent 5268.4, received 7159.7
  debug1: Exit status -1
  
  ```
  
  This is what I get after I insert the password.
  
  I will also post the sshd logs:
  
  ```
  Accepted password for jenkins from 82.78.220.8 port 40872 ssh2
  pam_unix(sshd:session): session opened for user jenkins by (uid=0)
  Received disconnect from 82.78.220.8 port 40872:11: disconnected by user
  Disconnected from 82.78.220.8 port 40872
  pam_unix(sshd:session): session closed for user jenkins
  
  ```
  
  I have this setup in the passwd:
  
  ```
  jenkins:x:113:118:Jenkins,,,:/var/lib/jenkins:/bin/bash
  
  ```
  
  I have to add that I can ssh with other users on the server just fine.
  I also tryed to **su jenkins** from root: This will just freeze my terminal and will open something like this:
  
  ```
  jenkins@vps531680:/root$ root@vps531680:~# root@vps531680:~# logout
  
  ```
  
  and I will get disconnected.
  
  I also tryed this **sudo usermod -s /bin/bash jenkins**:
  
  ```
  bash: /root/.bashrc: Permission denied
  jenkins@vps531680:~$ Killed
  
  ```
  
  On the weird side is that if I just reboot the server, for like 5-10 mins after that my jenkins user works just fine, but I will get disconnected after that time and I won't be able to SSH again, only after another reboot and for 5-10 mins. Any advice will be apreciated!
  
  **Tags:** jenkins, servers
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-03-13. Score: 1
  
  Check to see if the home directory for Jenkins was created?
  
  `/home/jenkins`
  
  > **Comments:**
  > **username_0**: No, there isn't any dir for that user, but on other VPS I don't have it either and works fine, in any case I created a dir jenkins in home, still the same issue.  
  > **username_1**: Was asking because I had this same issue and creating the directory solved it.  
  
  ---
  
  