SFTP error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SFTP error
# 1  
Old 03-17-2015
SFTP error

Hello Guys,

i am trying to connect to one server using SFTP, but i am getting the below error message.

HTML Code:
tcgetattr failed in ssh_rl_set_tty_modes_for_fd: fd 1: Not a typewriter
 
error: Connection lost
Code:
echo "Starting SFTP"
USERNAME=abc
PASSWORD=765a
echo "
ascii
put test.dat
bye" | sftp --password=$PASSWORD USERNAME@test.server.com#2200 > sftp.error 2>&1

i am using HP-UX OS. i am able to do this from the command line. i am having issues only when i try to run from shell script. Please help me on this. Thanks
# 2  
Old 03-17-2015
Seems that sftp wants a terminal for stdout. Does your sftp client have -b (batch) option? Maybe that will work and allow you capture stdout?

---------- Post updated at 10:55 AM ---------- Previous update was at 10:50 AM ----------

Most sftp programs don't have a --password option and expect you to use ssh keys and go passwordless for a 'batch' operation (just saying). In which case you might even be able to use scp instead of sftp.
# 3  
Old 03-17-2015
No. i tried using -B option as well. but i am getting the error "could not read the batch file, file: --password=765a". Please advise

Code:
 
sftp -B --password=$PASSWORD USERNAME@test.server.com#2200 > sftp.error 2>&1

# 4  
Old 03-17-2015
You will need to expand USERNAME with $ .
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Catching error in sftp

Hi All Experts, I have a script which logs to the server via sftp connection with below code :- user_name@sftp_server.com and the connection is going smooth. My requirement is to place file in sftp_server in some path. and if path doesn't exist or the file is not put successfully I... (3 Replies)
Discussion started by: punitsoneji
3 Replies

2. Solaris

Error while using sftp

Hi, In my Linux machine when am trying to do sftp to other server its not getting connected and its showing the below connection error. Even though I checked the daemon which is running fine. Any idea on this error will be helpful. sftp sftpuser@112.80.93.94 Connecting to 112.80.93.94...... (1 Reply)
Discussion started by: rogerben
1 Replies

3. 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@192.168.2.1 The above... (1 Reply)
Discussion started by: noobrobot
1 Replies

4. UNIX for Dummies Questions & Answers

SFTP Connection error

Hi I when I trying to SFTP a file to a server I am getting this below error: Connecting to 3.12.911.100... ssh_askpass: exec(/usr/lib/ssh/ssh-askpass): No such file or directory Host key verification failed. Connection closed Can you please help me in debugging this error. ... (3 Replies)
Discussion started by: krishna87
3 Replies

5. UNIX for Dummies Questions & Answers

SFTP Error

I am trying to SFTP a file using this script: FTPCHECK=`sftp $FTPUSER”@”$FTPHOST cd $FTPDESTDIR lcd $FILEPATH put $FILENAME close quit !` But when I run the Script I am facing the below error:... (3 Replies)
Discussion started by: krishna87
3 Replies

6. Shell Programming and Scripting

SFTP Error

Hi all, Could you please help me about a error in SFTP: sftp> put <file name> Uploading <file name> to <target> Couldn't write to remote file <file name>: Failure ID mismatch (272 != 5) Availing the message, Are there some documentation about "ID mismatch" error messages? Thanks... (2 Replies)
Discussion started by: speed_racer
2 Replies

7. UNIX for Dummies Questions & Answers

SFTP error when trying to connect

Hi, I am getting the following error when trying to use SFTP to go from my PROD to DEV. We are running AIX 5.3 64 bit. /home/tcutil/scripts 3720=>sftp -o Cipher=blowfish -o Compression=yes dradmin@xyz Connecting to xyz.... dradmin@xyz's password: buffer_get_ret: trying to get more bytes... (11 Replies)
Discussion started by: ramangill
11 Replies

8. Shell Programming and Scripting

SFTP Error Handling

Hi , Can any one tell me is there any standard method to track errors during sftp ? using which command i can track sftp errors ? i tried using echo $? . Most of the times i am getting error number 127 ,1, 255. whether it is constant numbers ? Please help me out. Thanks in advance (2 Replies)
Discussion started by: deepusunil
2 Replies

9. UNIX for Advanced & Expert Users

SFTP Error

Dear Gurus. Please help me with respect to SFTP error I am facing. We have setup private, public keys in source and target servers. But when we attempt the sftp as below it gives the error : sftp usnygidi@aaa1.bbb.deuba.co ssh_exchange_identification: Connection closed by remote host ... (1 Reply)
Discussion started by: yoursdivu
1 Replies

10. Shell Programming and Scripting

a peculiar error with sftp

Whenever I sftped a particular gzipped file to a particular directory and then try to unzip it, I get Permission Denied error. With this file even I cannot do chmod. though the file permissions are -rw-r--r-- When same file I sftp to a different location I am able to gunzip it. Directory... (0 Replies)
Discussion started by: RishiPahuja
0 Replies
Login or Register to Ask a Question