Every remote SSH command returns exit code 255

2,480 views
Skip to first unread message

Justinas Urbanavicius

unread,
Nov 20, 2013, 2:17:16 AM11/20/13
to jenkins...@googlegroups.com
Hi,

Having serious problems with executing remote command through ssh.
I've set up my Jenkins to ssh to remove Windows platforms, where sshd is installed using cygwin. Connection and publishing remote files works like a charm, but when it comes to command execution every single command fails and Jenkins reports that remove command exited with status code 255 (non zero).

console output:
SSH: Connecting session ...
SSH: Connected
SSH: Opening SFTP channel ...
SSH: SFTP channel open
SSH: Connecting SFTP channel ...
SSH: Connected
SSH: Remote root is not absolute, getting absolute directory from PWD
SSH: cd [/cygdrive/d/WWW]
SSH: OK
SSH: cd [builds]
SSH: OK
SSH: mkdir [jenkins-UAT-20]
SSH: OK
SSH: cd [jenkins-UAT-20]
SSH: OK
SSH: put [archive.zip]
SSH: OK
SSH: Opening exec channel ...
SSH: EXEC: channel open
SSH: EXEC: STDOUT/STDERR from command [pwd;] ...
SSH: EXEC: connected
SSH: EXEC: completed after 201 ms
SSH: Disconnecting configuration [UAT/PROD] ...
ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [255]]
Build step 'Send files or execute commands over SSH' changed build result to FAILURE

I'm using "Publish Over SSH" plugin v1.10, and as you can see even pwd command fails.
if i connect from remote machine my self and try to execute the same commands they work like a charm and exit status is normal == 0.
Remote machine i connect to is Windows 2003 x64 Server.

I have a similar setup with Windows 2008 R2 and it works great.

Does anyone have any suggestions ? I'm stumped here..

Massimiliano Del Moro

unread,
Nov 4, 2015, 11:54:24 AM11/4/15
to Jenkins Users
Try this:
1. Open the Services management window on the machine hosting the SSH server (hit windows key, type "services", select "Services" from the list of matches).

2. Find the service (should be 'OpenSSH') and open it's properties

3. Switch to Log On tab

4. Change the service credentials the service is running with: instead of local system user, choose the user you are using to establish the SSH connection.

5. Restart service.

Alternative is to fix local system user account (probably environment variables) so it works as local system user.

Reply all
Reply to author
Forward
0 new messages