0% found this document useful (0 votes)
6K views2 pages

Automating SFTP with Batch Files

The document discusses using a batch file to automatically transfer files from an SFTP site. The user is getting a "Permission denied" error when trying to run SFTP with a batch file that includes the password. Several responses provide solutions, such as using SSHPASS to pass the password without storing it in the file, setting up public key authentication instead of a password, or using alternative Windows tools like PSFTP that can run batch files. All recommend configuring key-based authentication for more secure automated access rather than storing passwords in files.

Uploaded by

KARTHIK145
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6K views2 pages

Automating SFTP with Batch Files

The document discusses using a batch file to automatically transfer files from an SFTP site. The user is getting a "Permission denied" error when trying to run SFTP with a batch file that includes the password. Several responses provide solutions, such as using SSHPASS to pass the password without storing it in the file, setting up public key authentication instead of a password, or using alternative Windows tools like PSFTP that can run batch files. All recommend configuring key-based authentication for more secure automated access rather than storing passwords in files.

Uploaded by

KARTHIK145
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
  • Introductory Guide on sftp Batch File Usage

signup

[Link]'s100%free.

Howtosendpasswordusingsftpbatchfile
I'mtryingtodownloadafilefromsftpsiteusingbatchscript.I'mgettingthefollowingerror:
Permissiondenied(publickey,password,keyboardinteractive).
Couldn'treadpacket:Connectionresetbypeer

Whenrunningthecommand:
sftpb/home/[Link]<user>@<serverip>:<folder>

the

[Link]

includesthesedata:

password
lcd[localfolder]
cd[sftpserverfolder]
get*
bye

Note:It'sworkingwhenrunningatthepromptas
sftp<user>@<serverip>:<folder>

ButIneedtheabilitytoenterthepasswordautomatically.
batchfile passwords sftp

editedJul16at16:17

askedJul31'12at10:33

Pi
8,302

judith
17

63

129

145

14

1 Isitworking,byremovingthepasswordfromthebatchfile?Doestheremainingfunctionalityworkwell,by
enteringthepasswordmanually?mtk Aug1'12at8:03
Storingthepasswordinplaintextinafileisobviouslynotsecureifyoudon'twanttotypeinapassword
everytimeIstronglysuggestusingRSAkeyauthentication.lindheNov1'14at0:15

4Answers

You'[Link]:
sshpasspYOUR_PASSWORDsftpoBatchMode=nobYOUR_COMMAND_FILE_PATHUSER@HOST

Obviously,it'[Link]'simpossibletodo,
forwhateverreason.
answeredFeb1'14at4:56
JoeVanDyk
3,222

30

Thankyou![Link]'ssimplynot
possibletogetakeyfile.jbrownApr29at14:40

Ifyouaregeneratingaheapofcommandstoberun,thencallthatscriptfromaterminal,youcan
trythefollowing.
sftplogin@host</path/to/command/list

Youwillthenbeaskedtoenteryourpassword(aspernormal)howeverallthecommandsinthe
scriptrunafterthat.
Thisisclearlynotacompletelyautomatedoptionthatcanbeusedina

cron

job,butitcanbe

54

login

tour

help

stackoverflowcareers

Signup

usedfromaterminal.
answeredFeb6'14at0:47
Tigger
2,567

14

20

[Link].
Themanualclearlystates:
[Link],itis
necessarytoconfigurenoninteractiveauthenticationtoobviatetheneedtoenterapassword
atconnectiontime(seesshd(8)andsshkeygen(1)fordetails).
[Link]'llbeabletorunabatch
script.
[Link].
editedJul21'13at1:04

answeredJul21'13at0:58
akond
7,195

16

36

Youmentionbatchfiles,amIcorrectthenassumingthatyou'retalkingaboutaWindowssystem?
Ifsoyoucannotusesshpass,andyouwillhavetoswitchtoadifferentoption.
Twoofsuchoptions,thatfollowdiametricallyoppositephilosophiesare:
psftp:commandlinetoolthatyoucancallfromwithinyourbatchscriptspsftpispartofthe
PuTTYpackageandyoucanfindithere
[Link]
[Link]:ascriptableFTP/SandSFTPclientforWindowsthatallowsyouto
storeyourpasswordinencrypted"profilefiles"checkitouthere
[Link]
Eitherway,switchingfrompasswordtoPKIauthenticationisstronglyrecommended.
editedMay18at16:55

answeredOct12'14at16:12
FjodrSo
66

You might also like