Unable to copy files from sftp server to workspace via Jenkins

Hi Team,

we are unable to copy files from sftp server to workspace, but job finished as success.

Started by user CHANDRASEKHAR TADIVAKA Running as SYSTEM Building in workspace /var/jenkins_home/workspace/BIOGEN_SFTP/Filecopy_JOB_remote_to_local SSH: Connecting from host [0316583eddd0] SSH: Connecting with configuration [jenkinsprod] … SSH: Creating session: username [kritesh], hostname [192.168.100.202], port [22] SSH: Connecting session … SSH: Connected SSH: Opening exec channel … SSH: EXEC: channel open SSH: EXEC: STDOUT/STDERR from command [ ./Filecopytolocal_script.sh lhprod 192.168.104.60 /home/inbound/biogen-biologics/prod /var/lib/docker/volumes/jenkins_home/workspace/BIOGEN_SFTP/Filecopy_JOB_remote_to_local ‘OMAVELOXOLONE_INVENTORY_MTHLY_BIOLOGICS_20250501021934.txt’ ] … SSH: EXEC: connected Connecting to 192.168.104.60… Permission denied, please try again. Received disconnect from 192.168.104.60 port 22:2: Too many authentication failures Authentication failed. Couldn’t read packet: Connection reset by peer File transfer completed. SSH: EXEC: completed after 200 ms SSH: Disconnecting configuration [jenkinsprod] … SSH: Transferred 0 file(s) Build step ‘Send files or execute commands over SSH’ changed build result to SUCCESS Finished: SUCCESS

Seems you not using Jenkins but you have script that does the coyping.
So it would help if you share the shell script that you’re using. Does the script work when you run it manually on your controller (you’re not using an agent) as the OS user that runs Jenkins?

And when doing ssh are you using an ssh-agent to provide the credentials for the ssh connection?

Hi There,

Thanks for your reply. We are using Jenkins only. Below is the screenshot for reference.

However , same job is working for other projects

But you run the sftp copy inside a shell script. So you’re not using any steps that are specifically created for Jenkins to do copy files over sftp.
So repeating my question: Does the script run when you execute is directly from a bash outside of Jenkins with the same OS user you use to run the Jenkins instance?

And with script you should share I meant the script that you call in the shell step Filecopytolocal_script.sh