problem with connecting sftp server(urgent please)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting problem with connecting sftp server(urgent please)
# 1  
Old 05-07-2008
Question problem with connecting sftp server(urgent please)

Hi all,

I have command to connect gateway server
iam in home directory/> ssh root@mrp-gateway
root@mrp-gateway:/root> sftp -v msgGoogle@126.132.45.123
sftp/>dir
upload --> folder
sftp/upload/ls
-------------
8990.txt
kittu.txt
8989.txt

i have an requirement to print files list which contain upload folder in the sftp server.

connectSFTP.sh
--------------------
#!/bin/bash
sftpList=`ssh root@mrp-gateway && sftp -v msgGoogle@126.132.45.123 && cd \upload\ && ls`
echo $sftpList



but this command is not working
can any one help me how to solve this issue.
# 2  
Old 05-12-2008
Your script is executing each of the commands seperated by && in order. It's not passing the additional commands to the first as it should.
As a result, your script is first ssh'ing to mrp-gateway, then once that ssh session finishes (ie it'll sit there until it gets logged out) it then attempts an sftp to 126.132.45.123 from the original server (not from the gateway).
Once that sftp session ends (or fails to connect), it will attempt to change directory (again, on the originating server) to 'upload' then run an ls on it.

I suspect what you want to do is to pass the various commands as aprameters to the earlier commands.

For example, to have the gateway server initate the sftp connection:
Code:
ssh root@mrp-gateway 'sftp -v msgGoogle@126.132.45.123'

# 3  
Old 05-12-2008
Quote:
Originally Posted by Smiling Dragon
Code:
ssh root@mrp-gateway 'sftp -v msgGoogle@126.132.45.123:\upload\'

Should negate the need to issue the cd statement after connecting.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Needed SFTP script from windows to UNIX server and from UNIX to windows server(reverse SFTP)

hi guys, i need a script to sftp the file from windows to unix server ....(before that i have to check whether the file exists in the windows server or not and again i have to reverse sftp the files from unix to windows server..... regards, Vasa Saikumar. (13 Replies)
Discussion started by: hemanthsaikumar
13 Replies

2. Solaris

Script to get files from remote server to local server through sftp without prompting for password

Hi, I am trying to automate the process of fetching files from remote server to local server through sftp. I have the username and password for the remote solaris server. But I need to give password manually everytime i run the script. Can anyone help me in automating the script such that it... (3 Replies)
Discussion started by: ssk250
3 Replies

3. Shell Programming and Scripting

SFTP problem......File not getting from Remote server

Hi, We are using one unix script which is using sftp command and connect to remote server and get some file form remote server. some time after running this script we are not getting any file . Could you please tell us detailed validation that is there any problem with... (6 Replies)
Discussion started by: maheshkumar93@g
6 Replies

4. Shell Programming and Scripting

Script connecting to SFTP server

hi, i have to type a script that connect to a server SFTP(password not required) and run some easy command (e.g. ls,rm,mv,etc...). I wrote into the script the connection-string and the other commands. When I run it, it connects perfectly to the server but it stops at the home. Here is... (8 Replies)
Discussion started by: zangarules
8 Replies

5. Emergency UNIX and Linux Support

SFTP issue when connecting from MVS to AIX

Dear all, I was given the ID_DSA.pub by an MVS user, which I placed in the appropriate user's authorized_keys file. When the user tris to SFTP from their side to the AIX box, the following error is got: error: debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY ... (6 Replies)
Discussion started by: ggayathri
6 Replies

6. UNIX for Dummies Questions & Answers

Doubt in Oracle connecting unix - Very urgent

I am using a oracle query from unix.. flag=`sqlplus -s <<EOF SELECT 'Y' FROM table_name WHERE cond1 = '${table_name}' AND DECODE('${var_a}','''NA''',own,'${var_b0}')= own exception when no_data_found then dbms_output.put_line(NVL(l_owner_flag,'X')); end; EOF` Its not validating the... (7 Replies)
Discussion started by: sivakumar.rj
7 Replies

7. Ubuntu

Connecting to a remote server

Hi, I have an interesting problem. I cannot connect to a personal server I set up. What's interesting is that I can connect to it from the LAN using its non-local IP address. However, I cannot seem to connect to it from anywhere else. Here's how my server is set up: My entire home has a... (8 Replies)
Discussion started by: Altay_H
8 Replies

8. Solaris

Urgent need help - issue sftp

hi experts, i have a problem with my sftp which install on sparc sun solaris os version 5.9, i have install this packages below on my server : libgcc-3.3-sol8-sparc-local openssl-0.9.8d-sol8-sparc-local zlib-1.2.3-sol8-sparc-local openssh-4.5p1-sol8-sparc-local and i... (2 Replies)
Discussion started by: bucci
2 Replies

9. Solaris

sftp error message VREY VERY URGENT

when one custmer connect using sftp got the following delivery report can you plase suggest on the issue. 14:04:36 SFTP Delivery properties: Host: <ip> Target Folder: </home> User: <user> 14:04:36 Keys loaded succeffuly 14:04:36 GEN-E-GENERAL, Error connecting to server : Invalid... (6 Replies)
Discussion started by: GIC1986
6 Replies

10. UNIX for Dummies Questions & Answers

connecting my server to comcast

Hi, I just setup a server running centos 4 that I am going to use for a mail server. I setup NAT in my router to open up the smtp port and i assigned the server a static ip address using ifconfig. Now is there a step im missing because now i cant route out of the server or ping anything? Oh btw... (0 Replies)
Discussion started by: mcraul
0 Replies
Login or Register to Ask a Question