sftp command

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sftp command
# 1  
Old 08-14-2009
sftp command

Hello folks
i want to know hoaw can i automate sftp command.
When i am execute the script it sftp connect to host and ask for the password but i want password also to be supplied in batfile .It should not ask password on console .

sftp -b batfile user@hostip
# 2  
Old 08-14-2009
Here is how to do it:
sftp runs under ssh, so you need to get ssh passwordless connections going:
ssh-keygen: password-less SSH login
# 3  
Old 08-14-2009
Originally Posted by jim mcnamara
Here is how to do it:
sftp runs under ssh, so you need to get ssh passwordless connections going:
ssh-keygen: password-less SSH login

Cant it be possibe that it can automaticaly read the password from the batfile and than connect
# 4  
Old 08-14-2009
ssh keys provide passwordless access. ssh is NOT designed to allow -b to have a password in the batch file. As you leanred. You can probably find a workaround by writing a daemon with controlling terminal, but why do that? ssh has keyts for the purpose.

IF this does not suit you use ftp, It does allows passwords in a script.

The reason for this - hardcoded passwords are a major security problem.
# 5  
Old 08-14-2009
Have a look a lftp. It supports fully scripted sftp sessions using SSH.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sftp ls command

Hi Team, i need to capture the file creation date and time ,but i tried ls -l only working . Cloud please help me to display year month data and time. Thanks, Murali (1 Reply)
Discussion started by: bmk123
1 Replies

2. Shell Programming and Scripting

Passing -f with rm command in sftp

Is there any way I can pass -f with rm command in sftp? If I use it it treats -f as a file name to be removed. sftp> rm -f abcd Couldn't stat remote file: No such file or directory Removing /home/sdesai/-f Couldn't delete file: No such file or directory sftp> "rm -f" abcd Invalid... (2 Replies)
Discussion started by: Soham
2 Replies

3. UNIX for Beginners Questions & Answers

Question about SFTP command

Hi All, This is JCL that contain command script to copy file to destionation (UNIX) I have 2 questions. ********* //NATTOUT1 JOB ACCL,'XXXXYYYY',CLASS=A,MSGCLASS=X, // NOTIFY=&SYSUID,REGION=0M,USER=SFTPXXX // SET... (1 Reply)
Discussion started by: getandput
1 Replies

4. UNIX for Advanced & Expert Users

Batch SFTP command Help

I need to run a test SFTP command in a batch mode and what I need to prompt my password after the sftp userid@hostname. I do not have have an ssh key exchanged between my server and the external server. I only have access to it as an sftp server. I must enter my password in my script. How do i... (2 Replies)
Discussion started by: mrn6430
2 Replies

5. Red Hat

Sftp command not working

What is wrong with this sftp command being used in one line: sftp /Data/SEmisstn.gz lsmsadit@ The ssh key is already setup. The node is valid and i can ssh to it as well as do a manual step by step sftp to the server. However, for some odd reason, i... (10 Replies)
Discussion started by: mrn6430
10 Replies

6. Shell Programming and Scripting

SFTP Command

Hi Freinds, I need to transfer the files from the Remote server using SFTP. While i transfer the file, the time stamp of the file need not to be changed. Ineed to transfer the file as without change in its time stamp. Is the any option or commands available. pl let me know... Regards,... (3 Replies)
Discussion started by: C_PRASANNA
3 Replies

7. Shell Programming and Scripting

SFTP-how to log individual sftp command error while executing shell script

Hi, I have situation where i need to automate transferring 10000+ files using sftp. while read line do if ; then echo "-mput /home/student/Desktop/folder/$line/* /cygdrive/e/folder/$line/">>sftpCommand.txt fi done< files.txt sftp -b sftpCommand.txt stu@ The above... (1 Reply)
Discussion started by: noobrobot
1 Replies

8. UNIX for Dummies Questions & Answers

problem with command sftp

Hi, I am entering this line in a .sh sftp -b operacionesftp.batch ${USER_FTP_SALIDA}@${FTP_SALIDA} but it seems to take only "b" and not "-b" may be due to? Greetings. (0 Replies)
Discussion started by: pepeli30
0 Replies

9. UNIX for Advanced & Expert Users

Using Macros in sftp command

Hi, I've some existing scripts wherein am using ftp + .netrc. I've defined my macros in .netrc file. I want to switch to sftp now but it seems it doesn't support macros and .netrc and it gives "command invalid" error. Is there any other alternative? Note: I don't want help for... (1 Reply)
Discussion started by: ps51517
1 Replies

10. Cybersecurity

Specify password in SFTP command

Hi, How can I specify a password on the scp command line so that it should not prompt for the password? Shabu (3 Replies)
Discussion started by: shabu
3 Replies
Login or Register to Ask a Question