Trouble connecting to FTP proxy server


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Trouble connecting to FTP proxy server
# 1  
Old 11-18-2010
Trouble connecting to FTP proxy server

Hi Guys,
I have trouble connecting to ftp server. My task is to connect to the proxy server and get the latest file to the local machine. It works fine when i do the same steps manually. I've been trying to do it in multiple ways but im just not able to connect. When i check the log, this is what it says:
Connected to ftpproxy.xx.xxxx.com.
220 <ip address> CSM Proxy Server FTP Proxy ready for login
ftp>
It is not going beyond this.

Below is my script: (we are using Linux)
#!/bin/sh
$server=ftpproxy
$user=user k123456@xxx.abcdef.com
$password=password
$dir=/abc/xyz/work
$filename=1234.def.ghi.$$

cd $dir (on local machine)
ftp -u $server <<EOF (connecting to the proxy server)
##i tried using -n as well...but it is not working
#the script is not going beyond this point
user $user $password
##i tried giving password in the next line as well, like this:
#user $user
#$password
ls
binary
get $filename
bye
EOF

I too have the .netrc file in the HOME directory but with a different name.


FYI..this is what i do manually:
ftp -u ftpproxy
ftp> user k123456@xxx.abcdef.com
ftp> <<password>>
ftp> ls
ftp> binary
ftp> get file
ftp> bye


Please help me connecting to the FTP server...because this being the first step in the script..i am not able to execute the other steps as well.


Thanks in advance!!
# 2  
Old 11-18-2010
use .netrc or write an Expect wrapper script
# 3  
Old 11-18-2010
how do i use .netrc or write an expect wrapper script...
During my investigation i found that by using .netrc we can enable autologin. But i was not able to find how do we include that in the script.
Could you please provide me some more information regarding this?

Thanks!!
# 4  
Old 11-18-2010
search the forums or google. plenty of examples out there.
# 5  
Old 11-19-2010
Though this sounds silly...Can i write expect script in Linux environment?

If so...will this work?

#!/bin/sh
server=ftpproxy
user_id=user k123456@xxx.abcdef.com
password=password
dir=/abc/xyz/work
filename=1234.def.ghi.$$

cd $dir

spawn ftp $server
expect "username:"
# Send the username,
send "$user_id\r"
expect "password:"
# Send the password,
send "$password\r"
expect "ftp>"
# Switch to binary mode,
send "bin\r"
expect "ftp>"
# Turn off prompting.
send "prompt\r"
expect "ftp>"
# Get all the files
send "mget $filename\r"
expect "ftp>"
send "bye\r"
expect eof


Please let me know if i have to make any changes to the script.
Thanks in advance!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Ubuntu

Trouble Connecting to Wi-Fi Via GUI

Note: I originally posted this question on unix.stackexchange.com. But as my question was down-voted within an hour of asking, I came to the conclusion that perhaps I need to quit attempting to get help on StackExchange or that my inquiry is simply moronic. If anyone feels that my question is not... (7 Replies)
Discussion started by: AntumDeluge
7 Replies

2. IP Networking

Connecting via proxy chain to Upstream proxy

I need to configure a proxy on my local machine to use an upstream proxy (installed on another machine). The upstream proxy requires Digest/NTLM authorization. I want the local proxy to deal with the upstream proxy's authorization details and provides authorization free access to users that connect... (0 Replies)
Discussion started by: Russel
0 Replies

3. Shell Programming and Scripting

Connecting to a server using FTP is hanging

Hi Friends I have created a shell script to connect to a windows server. But the problem is while trying to run the script I am not getting any output. After running the script it is hanged and the prompt is not showing until if I press the ctrl+Z to break the script. I also tried using the FTP... (2 Replies)
Discussion started by: Kannannair
2 Replies

4. Solaris

Ftp: SSL_connect error while connecting from source to destination server Solaris 10

Hi Everyone, I am using solaris 10.I am facing a different problem here with tlsftp.I have intalled all steps for tlsftp and able to connect to the destination server from the source server.It worked for some days.But recently when i am connectin it is giving below error.I am... (0 Replies)
Discussion started by: muraliinfy04
0 Replies

5. Shell Programming and Scripting

Issue with Connecting to ftp server

Hi All, I have a ftp link as "ftp://ftp1.xyz.org/abc_ike/". The same thing is opening fine when I use a browser. But I am not sure how to connect to the above link from console. I used the command ftp ftp1.xyz.org The above is not working. I am not getting any error it simply stands still.... (1 Reply)
Discussion started by: machomaddy
1 Replies

6. Red Hat

Ftp problem on proxy server

Hi all, First of all i would like to say sorry to all for my english. My name is Mastan. We have an proxy server have 2 lan cards. one is for public and another for private. public ip: 182.72.141.... private ip: 192.168.0.0 So, the thing is i configure ftp server in my local for... (0 Replies)
Discussion started by: mastansaheb
0 Replies

7. UNIX for Advanced & Expert Users

Unix FTP Script connecting through proxy Not working

Hi All, can some one please help me to solve this issue, its urgent:confused: We need to FTP a file form our Unix server to an external client FTP location. I am trying to connect to the proxy server first and then use the below USER comment to connect to the external FTP server, and its working... (3 Replies)
Discussion started by: JesusJoseph
3 Replies

8. Shell Programming and Scripting

Connecting to other server thru ftp

Hi, Can someone help me on how to ftp to UNIX server from an another UNIX Server. I tried the follwoing but it is not working. ftp -n 10.10.0.1 quote user usrname quote pass passwd ls Though ftp is starting it is not allowing me run command..... it is asking to Thanks in... (5 Replies)
Discussion started by: EmbedUX
5 Replies

9. Linux

Trouble connecting to internet

I am having trouble connecting to the internet. Details: OpenSuse 11.1, Cable Modem, connected to Linksys Wireless N Router, hard line from router to ethernet port on my computer. I checked network settings in YAST2, my ethernet is showing not connected. I have it set to start at boot, and... (4 Replies)
Discussion started by: stringzz
4 Replies

10. IP Networking

Software/tool to route an IP packet to proxy server and capture the Proxy reply as an

Hi, I am involved in a project on Debian. One of my requirement is to route an IP packet in my application to a proxy server and receive the reply from the proxy server as an IP packet. My application handles data at the IP frame level. My application creates an IP packet(with all the necessary... (0 Replies)
Discussion started by: Rajesh_BK
0 Replies
Login or Register to Ask a Question