LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-19-2010, 04:48 AM   #1
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Rep: Reputation: 33
vsFTPd and ftp_ssl_connect (php)


This question is related to vsFTPd and FTP+SSL, not PhP.

I have the following php-code (read a local file and write its contents through FTP to a remote server) :
Code:
$remotefilename="test";
$source = fopen("test.txt","r");
//Opening an ftp connection
$conn = ftp_ssl_connect("192.168.1.150") or die("Could not connect");
ftp_login($conn,"user1","passwd1"); //log in to ftp session
if( !$conn ){
    echo "FTP server connection error" . "<BR>";
    exit;
}
else{
   echo "Connected to FTP Server" . "<BR>";
   echo "conn=".$conn."<br>";
   $putfile=ftp_fput($conn,$remotefilename,$source,FTP_ASCII);
   echo "putfile = ".$putfile."<br>";
}
echo "pwd: ".ftp_pwd($conn);
fclose($source); //close the local file
ftp_close($conn); //close the ftp session
?>
The output is :
Quote:
Connected to FTP Server
conn=Resource id #4
putfile =
pwd:
So it seems that I am able to connect to the vsFTPd-server with user1 but nothing happens...

When using ftp_connect("192.168.1.150") (not ssl) then everything works fine.

I'm a bit confused and worried about the possibility to be able to connect to the server.

My vsFTPD-server has ssl-support built-in :
Code:
[root@server ]# ldd /usr/sbin/vsftpd | grep ssl
	libssl.so.7 => /lib/libssl.so.7 (0x00ec0000)
The user 'user1' has no shell :
Code:
[root@server ]# cat /etc/passwd | grep user1
user1:x:501:501::/etc/dir/addondir:/sbin/nologin
I see nothing in the logfile /var/log/vsftpd.log when connecting with ftp_ssl_connect.

When connecting with ftp_connect, the logfile reads :
Quote:
Fri Mar 19 09:29:56 2010 1 192.168.1.151 21 /test a _ i r user1 ftp 0 * c
So am I connected to the vsFTPd-server ??
Does my user1 needs a shell (tried it with /bin/bash but no change) ??
Will ftp_ssl_connect work with a local certificate (cd /etc/pki/tls/certs && make vsftpd.pem) ??
Is it not working because my 'user1' is chrooted to /etc/dir/addondir ??

Last edited by jonaskellens; 03-19-2010 at 04:49 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
vsftpd settingd and VSFTPD DEAD BUT SUBSYS LOCKED pc_copat Linux - Newbie 15 11-05-2009 11:31 PM
add virtual users to vsftpd with php mattsoftnet Programming 0 05-09-2008 01:33 PM
vsftpd.conf/chroot/vsftpd.chroot_list issue Jerman Linux - Security 2 06-01-2007 08:24 PM
vsftpd & ssl - how do I tell if it's actually vsftpd maintaining the connections?? hunterhunter Linux - General 0 03-27-2006 05:41 PM
VSFTPD with 500 oops :vsftpd: missing argv[0] mole_13 Linux - Newbie 0 05-04-2005 02:05 AM


All times are GMT -5. The time now is 10:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration