jonaskellens |
03-19-2010 03:48 AM |
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 ??
|