How to connect to FTP server which requires SSL authentication? | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

How to connect to FTP server which requires SSL authentication?

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 10-31-2011
amitshete amitshete is offline
Registered User
 
Join Date: Jun 2010
Last Activity: 5 February 2012, 8:53 AM EST
Posts: 16
Thanks: 3
Thanked 0 Times in 0 Posts
How to connect to FTP server which requires SSL authentication?

Hello,

I tried searching through lot of threads for a solution but couldn't fetch the exact solution, so I am creating a new thread.

I am trying to connect to a FTP server

1) using a simple FTP command, it gives the error :

Code:
534 Policy requires SSL.
Login failed.

2) using SFTP command on port number 21

Code:
ssh_exchange_identification: read: Connection reset by peer
Couldn't read packet: Connection reset by peer

3) using curl command, it throws following error

Code:
curl: (67) Access denied: 534

I am stuck at this point and could not think of any solution. Let me know if I am missing out on anything here.

Thanks in advance & apologies if a similar thread already exist.

Regards,
Amit

Last edited by Scott; 11-09-2011 at 01:35 PM.. Reason: Code tags...
Sponsored Links
    #2  
Old 10-31-2011
ahamed101's Avatar
ahamed101 ahamed101 is offline Forum Advisor  
root is god!!!
 
Join Date: Sep 2008
Last Activity: 15 May 2014, 2:54 PM EDT
Location: San Jose, CA
Posts: 1,906
Thanks: 54
Thanked 485 Times in 478 Posts
1. May be due to iptables or other firewalls. Try turning off the firewall and then ftp.
For turning off iptables, do /etc/init.d/iptables stop

2. SSH keys are not setup (Search for "passwordless ssh" in unix.com/google) or the SSH daemon is not running.

Code:
[root@bt]ps -eaf | grep sshd
root      1987     1  0  2010 ?        00:00:00 /usr/sbin/sshd

To start the ssh daemon /etc/init.d/sshd start

3. Same as 1.

Make sure the ftp daemon is running on the server. Mine is vsftpd.

Code:
[root@bt]ps -eaf | grep ftp
root      2083     1  0  2010 ?        00:00:00 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf

To start the ftp daemon
/etc/init.d/vsftpd start

HTH
--ahamed
Sponsored Links
    #3  
Old 10-31-2011
cero cero is offline
Registered User
 
Join Date: Aug 2006
Last Activity: 24 October 2014, 10:27 AM EDT
Posts: 378
Thanks: 3
Thanked 69 Times in 63 Posts
Hi,
there are some ftp-protcolls that use ssh/ssl. Did you try FTPS or FTP over SSH?
    #4  
Old 10-31-2011
amitshete amitshete is offline
Registered User
 
Join Date: Jun 2010
Last Activity: 5 February 2012, 8:53 AM EST
Posts: 16
Thanks: 3
Thanked 0 Times in 0 Posts
Hi Ahamed,

Thanks for your response. I tried all the options you have suggested.
1) Turned off the firewall
2) SSHD services were running

But it did not help

@Cero : could you please elaborate on those options with an example. I haven't tried those.

Thanks

- Amit
Sponsored Links
    #5  
Old 10-31-2011
cero cero is offline
Registered User
 
Join Date: Aug 2006
Last Activity: 24 October 2014, 10:27 AM EDT
Posts: 378
Thanks: 3
Thanked 69 Times in 63 Posts
Did you get information about the used protocol when you got username and password?
I'd try the easiest method first. Issue AUTH SSL before sending username and password in an normal ftp-session.
I never had to use FTP over SSH - its basically tunneling normal FTP over an ssh-connection.
For FTPS you need a client that can handle that protocol like lftp. Opening a connection with lftp could look like this:

Code:
lftp -c 'open -e "set ftps:initial-prot ""; \
   set ftp:ssl-force true; \
   set ftp:ssl-protect-data true; "\
   <your FTP command>; " \
   -u "USERNAME","PASSWORD" \
   ftps://HOSTNAME:990 '

Sponsored Links
    #6  
Old 10-31-2011
amitshete amitshete is offline
Registered User
 
Join Date: Jun 2010
Last Activity: 5 February 2012, 8:53 AM EST
Posts: 16
Thanks: 3
Thanked 0 Times in 0 Posts
Hello Cero,

I tried that option, it is throwing an error :

Code:
/lib64/libcrypto.so.6: undefined symbol: inflateEnd
connect: ftp - not supported protocol

Do we have to set up any env variables before using lftp ?

- Amit

Last edited by Scott; 11-09-2011 at 01:37 PM.. Reason: Code tags
Sponsored Links
    #7  
Old 10-31-2011
cero cero is offline
Registered User
 
Join Date: Aug 2006
Last Activity: 24 October 2014, 10:27 AM EDT
Posts: 378
Thanks: 3
Thanked 69 Times in 63 Posts
Which option did you try? AUTH SSL or ftps?
For ftps you need a version of lftp compiled with tls support. This one for example supports ftps transfers:

Code:
$ lftp -v
LFTP | Version 3.7.3 | Copyright (c) 1996-2008 Alexander V. Lukyanov

LFTP is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
There is absolutely no warranty for LFTP.  See COPYING for details.

Send bug reports and questions to <lftp@uniyar.ac.ru>.

Libraries used: Readline 5.2, GnuTLS 2.4.2, zlib 1.2.3.3

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
microsoft Server 2008 Active authentication to a linux server venhart Red Hat 1 08-10-2011 11:16 AM
Connect to Server B from Server A and Archive the file vsmeruga Shell Programming and Scripting 3 04-01-2010 12:29 AM
To Connect to Windows server from Unix server vidzz911 Windows & DOS: Issues & Discussions 4 04-10-2009 08:56 AM



All times are GMT -4. The time now is 10:54 PM.