You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-users@mina.apache.org by Erik Morton <ei...@gmail.com> on 2008/08/19 23:31:46 UTC
Problem getting the server working on MacOSX Leopard
Hello. I'm very excited about the ftpserver, however I'm having
problems getting it working properly on OSX. I have a user configured
like so:
+--------+--------------+---------------+------------+-----------------
+----------+------------+--------------+----------------
+---------------+
| userid | userpassword | homedirectory | enableflag | writepermission
| idletime | uploadrate | downloadrate | maxloginnumber |
maxloginperip |
+--------+--------------+---------------+------------+-----------------
+----------+------------+--------------+----------------
+---------------+
| admin | admin | ./res/admin | 1 | 1
| 10 | 10 | 10 | 10 |
10 |
+--------+--------------+---------------+------------+-----------------
+----------+------------+--------------+----------------
+---------------+
I created a file called ./res/admin, which is chmod 777
And I am starting the server like so:
sudo ./bin/ftpd.sh /Users/me/java/ftp/res/conf/ftpd-full.xml
The configuration file doesn't explicitly define any listeners.
When I connect to the server I can't seem to ever put a file. PWD
tells me that the current directory is "/". I'm not sure if I'm
supposed to be put directly into ./res/admin or not.
My session is:
$ open localhost
$ admin
$ admin
$ pwd
$ put testftp.txt
$ bye
The log out put is below. Any help would be greatly appreciated.
[ INFO] 2008-08-19 17:13:26,478 [] [0:0:0:0:0:0:0:1%0] RECEIVED: USER
ADMIN
[ INFO] 2008-08-19 17:13:26,481 [admin] [0:0:0:0:0:0:0:1%0] SELECT
userid, userpassword, homedirectory,
enableflag, writepermission, idletime, uploadrate,
downloadrate,maxloginnumber,maxloginperip FROM
FTP_USER WHERE userid = 'admin'
[ INFO] 2008-08-19 17:13:26,496 [admin] [0:0:0:0:0:0:0:1%0] SENT: 331
User name okay, need password for admin.
[ INFO] 2008-08-19 17:13:28,732 [admin] [0:0:0:0:0:0:0:1%0] RECEIVED:
PASS *****
[ INFO] 2008-08-19 17:13:28,732 [admin] [0:0:0:0:0:0:0:1%0] SELECT
userid from FTP_USER WHERE userid='admin' AND
userpassword='admin'
[ INFO] 2008-08-19 17:13:28,733 [admin] [0:0:0:0:0:0:0:1%0] SELECT
userid, userpassword, homedirectory,
enableflag, writepermission, idletime, uploadrate,
downloadrate,maxloginnumber,maxloginperip FROM
FTP_USER WHERE userid = 'admin'
[ INFO] 2008-08-19 17:13:28,740 [admin] [0:0:0:0:0:0:0:1%0] Login
success - admin
[ INFO] 2008-08-19 17:13:28,741 [admin] [0:0:0:0:0:0:0:1%0] SENT: 230
User logged in, proceed.
[ INFO] 2008-08-19 17:13:28,741 [admin] [0:0:0:0:0:0:0:1%0] RECEIVED:
SYST
[ INFO] 2008-08-19 17:13:28,742 [admin] [0:0:0:0:0:0:0:1%0] SENT: 215
UNIX Type: Apache FtpServer
[ INFO] 2008-08-19 17:13:28,743 [admin] [0:0:0:0:0:0:0:1%0] RECEIVED:
FEAT
[ INFO] 2008-08-19 17:13:28,745 [admin] [0:0:0:0:0:0:0:1%0] SENT: 211-
Extensions supported
SIZE
MDTM
REST STREAM
LANG en;zh-tw;ja;is
MLST Size;Modify;Type;Perm
AUTH SSL
AUTH TLS
MODE Z
UTF8
TVFS
MD5
MMD5
211 End
[ INFO] 2008-08-19 17:13:28,746 [admin] [0:0:0:0:0:0:0:1%0] RECEIVED:
PWD
[ INFO] 2008-08-19 17:13:28,748 [admin] [0:0:0:0:0:0:0:1%0] SENT: 257
"/" is current directory.
[ INFO] 2008-08-19 17:13:38,397 [admin] [0:0:0:0:0:0:0:1%0] RECEIVED:
EPSV
[DEBUG] 2008-08-19 17:13:38,402 [admin] [0:0:0:0:0:0:0:1%0] Initiating
passive data connection
[DEBUG] 2008-08-19 17:13:38,403 [admin] [0:0:0:0:0:0:0:1%0] Opening
passive data connection on address "/0:0:0:0:0:0:0:1%0" and port 0
[DEBUG] 2008-08-19 17:13:38,403 [admin] [0:0:0:0:0:0:0:1%0] Passive
data connection created on address "/0:0:0:0:0:0:0:1%0" and port 0
[ INFO] 2008-08-19 17:13:38,404 [admin] [0:0:0:0:0:0:0:1%0] SENT: 229
Entering Passive Mode (|||57094|)
[ INFO] 2008-08-19 17:13:38,405 [admin] [0:0:0:0:0:0:0:1%0] RECEIVED:
STOR TESTFTP.TXT
[ INFO] 2008-08-19 17:13:38,407 [admin] [0:0:0:0:0:0:0:1%0] SENT: 550 /
testftp.txt: Permission denied.
Re: Problem getting the server working on MacOSX Leopard
Posted by David Latorre <dv...@gmail.com>.
Hello,
Are you sure you are in the 'right' directory?
Copy a file to your ./res/admin and check if it is visible from the FTP
client.
2008/8/19 Erik Morton <ei...@gmail.com>
> Hello. I'm very excited about the ftpserver, however I'm having problems
> getting it working properly on OSX. I have a user configured like so:
>
> +--------+--------------+---------------+------------+-----------------+----------+------------+--------------+----------------+---------------+
> | userid | userpassword | homedirectory | enableflag | writepermission |
> idletime | uploadrate | downloadrate | maxloginnumber | maxloginperip |
>
> +--------+--------------+---------------+------------+-----------------+----------+------------+--------------+----------------+---------------+
> | admin | admin | ./res/admin | 1 | 1 |
> 10 | 10 | 10 | 10 | 10 |
>
> +--------+--------------+---------------+------------+-----------------+----------+------------+--------------+----------------+---------------+
>
> I created a file called ./res/admin, which is chmod 777
>
> And I am starting the server like so:
> sudo ./bin/ftpd.sh /Users/me/java/ftp/res/conf/ftpd-full.xml
>
> The configuration file doesn't explicitly define any listeners.
>
> When I connect to the server I can't seem to ever put a file. PWD tells me
> that the current directory is "/". I'm not sure if I'm supposed to be put
> directly into ./res/admin or not.
> My session is:
> $ open localhost
> $ admin
> $ admin
> $ pwd
> $ put testftp.txt
> $ bye
>
> The log out put is below. Any help would be greatly appreciated.
>
> [ INFO] 2008-08-19 17:13:26,478 [] [0:0:0:0:0:0:0:1%0] RECEIVED: USER ADMIN
> [ INFO] 2008-08-19 17:13:26,481 [admin] [0:0:0:0:0:0:0:1%0] SELECT userid,
> userpassword, homedirectory,
> enableflag, writepermission, idletime, uploadrate,
> downloadrate,maxloginnumber,maxloginperip FROM
> FTP_USER WHERE userid = 'admin'
> [ INFO] 2008-08-19 17:13:26,496 [admin] [0:0:0:0:0:0:0:1%0] SENT: 331 User
> name okay, need password for admin.
>
> [ INFO] 2008-08-19 17:13:28,732 [admin] [0:0:0:0:0:0:0:1%0] RECEIVED: PASS
> *****
> [ INFO] 2008-08-19 17:13:28,732 [admin] [0:0:0:0:0:0:0:1%0] SELECT userid
> from FTP_USER WHERE userid='admin' AND
> userpassword='admin'
> [ INFO] 2008-08-19 17:13:28,733 [admin] [0:0:0:0:0:0:0:1%0] SELECT userid,
> userpassword, homedirectory,
> enableflag, writepermission, idletime, uploadrate,
> downloadrate,maxloginnumber,maxloginperip FROM
> FTP_USER WHERE userid = 'admin'
> [ INFO] 2008-08-19 17:13:28,740 [admin] [0:0:0:0:0:0:0:1%0] Login success -
> admin
> [ INFO] 2008-08-19 17:13:28,741 [admin] [0:0:0:0:0:0:0:1%0] SENT: 230 User
> logged in, proceed.
>
> [ INFO] 2008-08-19 17:13:28,741 [admin] [0:0:0:0:0:0:0:1%0] RECEIVED: SYST
> [ INFO] 2008-08-19 17:13:28,742 [admin] [0:0:0:0:0:0:0:1%0] SENT: 215 UNIX
> Type: Apache FtpServer
>
> [ INFO] 2008-08-19 17:13:28,743 [admin] [0:0:0:0:0:0:0:1%0] RECEIVED: FEAT
> [ INFO] 2008-08-19 17:13:28,745 [admin] [0:0:0:0:0:0:0:1%0] SENT:
> 211-Extensions supported
> SIZE
> MDTM
> REST STREAM
> LANG en;zh-tw;ja;is
> MLST Size;Modify;Type;Perm
> AUTH SSL
> AUTH TLS
> MODE Z
> UTF8
> TVFS
> MD5
> MMD5
> 211 End
>
> [ INFO] 2008-08-19 17:13:28,746 [admin] [0:0:0:0:0:0:0:1%0] RECEIVED: PWD
> [ INFO] 2008-08-19 17:13:28,748 [admin] [0:0:0:0:0:0:0:1%0] SENT: 257 "/"
> is current directory.
>
> [ INFO] 2008-08-19 17:13:38,397 [admin] [0:0:0:0:0:0:0:1%0] RECEIVED: EPSV
> [DEBUG] 2008-08-19 17:13:38,402 [admin] [0:0:0:0:0:0:0:1%0] Initiating
> passive data connection
> [DEBUG] 2008-08-19 17:13:38,403 [admin] [0:0:0:0:0:0:0:1%0] Opening passive
> data connection on address "/0:0:0:0:0:0:0:1%0" and port 0
> [DEBUG] 2008-08-19 17:13:38,403 [admin] [0:0:0:0:0:0:0:1%0] Passive data
> connection created on address "/0:0:0:0:0:0:0:1%0" and port 0
> [ INFO] 2008-08-19 17:13:38,404 [admin] [0:0:0:0:0:0:0:1%0] SENT: 229
> Entering Passive Mode (|||57094|)
>
> [ INFO] 2008-08-19 17:13:38,405 [admin] [0:0:0:0:0:0:0:1%0] RECEIVED: STOR
> TESTFTP.TXT
> [ INFO] 2008-08-19 17:13:38,407 [admin] [0:0:0:0:0:0:0:1%0] SENT: 550
> /testftp.txt: Permission denied.
>
>
Re: Problem getting the server working on MacOSX Leopard
Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Mon, Aug 25, 2008 at 5:29 PM, Erik Morton <ei...@gmail.com> wrote:
> Yes, I was able to upload a file with DbUserManager as the user manager.
I've made one further change, could you please update and verify if it
still works for you?
/niklas
Re: Problem getting the server working on MacOSX Leopard
Posted by Erik Morton <ei...@gmail.com>.
Yes, I was able to upload a file with DbUserManager as the user manager.
Thanks
Erik
On Aug 25, 2008, at 10:51 AM, Niklas Gustavsson wrote:
> On Mon, Aug 25, 2008 at 3:51 PM, Niklas Gustavsson <niklas@protocol7.com
> > wrote:
>> On Mon, Aug 25, 2008 at 3:41 PM, Erik Morton <ei...@gmail.com>
>> wrote:
>>> I realized that in DbUserManager
>>>
>>> if
>>> (trueStr.equalsIgnoreCase(rs.getString(ATTR_WRITE_PERM)))
>>> {
>>> authorities.add(new WritePermission());
>>> }
>>>
>>> is returning false under MySQL 5.037 because booleans are stored
>>> as tinyints
>>> and Boolean.TRUE.toString() is returning 'true'. I hacked around
>>> this issue
>>> for now, as I'm about six years removed from Java development and
>>> don't feel
>>> comfortable submitting a real patch :-).
>>
>> Yes, I realized the same thing and created a patch for it this
>> Friday,
>> but was offline for the entire weekend. I'll commit the fix later
>> today.
>
> Issue opened and fix commited:
> https://issues.apache.org/jira/browse/FTPSERVER-168
>
> Can you please verify if this fixes your issue?
>
> /niklas
Re: Problem getting the server working on MacOSX Leopard
Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Mon, Aug 25, 2008 at 3:51 PM, Niklas Gustavsson <ni...@protocol7.com> wrote:
> On Mon, Aug 25, 2008 at 3:41 PM, Erik Morton <ei...@gmail.com> wrote:
>> I realized that in DbUserManager
>>
>> if (trueStr.equalsIgnoreCase(rs.getString(ATTR_WRITE_PERM)))
>> {
>> authorities.add(new WritePermission());
>> }
>>
>> is returning false under MySQL 5.037 because booleans are stored as tinyints
>> and Boolean.TRUE.toString() is returning 'true'. I hacked around this issue
>> for now, as I'm about six years removed from Java development and don't feel
>> comfortable submitting a real patch :-).
>
> Yes, I realized the same thing and created a patch for it this Friday,
> but was offline for the entire weekend. I'll commit the fix later
> today.
Issue opened and fix commited:
https://issues.apache.org/jira/browse/FTPSERVER-168
Can you please verify if this fixes your issue?
/niklas
Re: Problem getting the server working on MacOSX Leopard
Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Mon, Aug 25, 2008 at 3:41 PM, Erik Morton <ei...@gmail.com> wrote:
> I realized that in DbUserManager
>
> if (trueStr.equalsIgnoreCase(rs.getString(ATTR_WRITE_PERM)))
> {
> authorities.add(new WritePermission());
> }
>
> is returning false under MySQL 5.037 because booleans are stored as tinyints
> and Boolean.TRUE.toString() is returning 'true'. I hacked around this issue
> for now, as I'm about six years removed from Java development and don't feel
> comfortable submitting a real patch :-).
Yes, I realized the same thing and created a patch for it this Friday,
but was offline for the entire weekend. I'll commit the fix later
today.
/niklas
Re: Problem getting the server working on MacOSX Leopard
Posted by Erik Morton <ei...@gmail.com>.
I realized that in DbUserManager
if
(trueStr.equalsIgnoreCase(rs.getString(ATTR_WRITE_PERM))) {
authorities.add(new WritePermission());
}
is returning false under MySQL 5.037 because booleans are stored as
tinyints and Boolean.TRUE.toString() is returning 'true'. I hacked
around this issue for now, as I'm about six years removed from Java
development and don't feel comfortable submitting a real patch :-).
On Aug 20, 2008, at 7:06 AM, Niklas Gustavsson wrote:
> On Wed, Aug 20, 2008 at 11:42 AM, Erik Morton <ei...@gmail.com>
> wrote:
>> Yes, silly typo. ./res/admin is a directory.
>>
>> I am able to get a file from ./res/admin, I just can't put a file
>> there.
>
> That's odd. Are you running from trunk? If so, I can add in some
> additional debug log statements so that we can see in more detail what
> happens.
>
> /niklas
Re: Problem getting the server working on MacOSX Leopard
Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Wed, Aug 20, 2008 at 11:42 AM, Erik Morton <ei...@gmail.com> wrote:
> Yes, silly typo. ./res/admin is a directory.
>
> I am able to get a file from ./res/admin, I just can't put a file there.
That's odd. Are you running from trunk? If so, I can add in some
additional debug log statements so that we can see in more detail what
happens.
/niklas
Re: Problem getting the server working on MacOSX Leopard
Posted by Erik Morton <ei...@gmail.com>.
Sure thing.
Results:
This is not a java.io.File bug, we need to check further.Created file
was: /Users/erik/Documents/projects/my_project/java/ftp/res/
prefix58446sufix
On Aug 20, 2008, at 7:54 AM, David Latorre wrote:
> There is a chance that is due to canWrite() returning false even if
> the
> directory is writable. There are several bug reports at
> http://bugs.sun.com/which complain about this fact (in most systems
> there isn't any syscall or
> function which will return this value correctly).
>
> Erik could you try this ?
>
> public static void main(String args[]) {
> File adminHome = new File(PATH_TO_RES_ADMIN);
> File aFile = null;
> if (!adminHome.canWrite()) {
> System.out.println("Problem found: canWrite returns
> false");
> try {
> aFile = File.createTempFile("prefix", "sufix",
> adminHome);
> System.out.println("canWrite does not work as
> expected in
> your environment, it returned false but the file " +
> aFile.getAbsolutePath()
> + " was created");
> } catch (IOException e) {
> System.out.println(PATH_TO_RES_ADMIN + " is actually
> non-writable hence the server response. Exception: ");
> e.printStackTrace();
> }
> } else {
> try {
> aFile = File.createTempFile("prefix", "sufix",
> adminHome);
> System.out.println("This is not a java.io.File bug,
> we need
> to check further.Created file was: " + aFile.getAbsolutePath());
> } catch (IOException e) {
> System.out.println("canWrite returns true but there
> was a
> problem trying to create the file. Exception: ");
> e.printStackTrace();
>
> }
> }
>
> if (aFile != null) {
> aFile.deleteOnExit();
> }
> }
>
>
> 2008/8/20 Erik Morton <ei...@gmail.com>
>
>> Yes, silly typo. ./res/admin is a directory.
>>
>> I am able to get a file from ./res/admin, I just can't put a file
>> there.
>>
>>
>> On Aug 20, 2008, at 3:45 AM, Niklas Gustavsson wrote:
>>
>> Cool, you're the first case of using IPv6 with FtpServer that I've
>> seen.
>>>
>>> On Tue, Aug 19, 2008 at 11:31 PM, Erik Morton <ei...@gmail.com>
>>> wrote:
>>>
>>>> I created a file called ./res/admin, which is chmod 777
>>>>
>>>
>>> When you say "file", do you really mean a directory?
>>>
>>> /niklas
>>>
>>
>>
Re: Problem getting the server working on MacOSX Leopard
Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Wed, Aug 20, 2008 at 1:54 PM, David Latorre <dv...@gmail.com> wrote:
> There is a chance that is due to canWrite() returning false even if the
> directory is writable. There are several bug reports at
> http://bugs.sun.com/which complain about this fact (in most systems
> there isn't any syscall or
> function which will return this value correctly).
Re: Problem getting the server working on MacOSX Leopard
Posted by David Latorre <dv...@gmail.com>.
There is a chance that is due to canWrite() returning false even if the
directory is writable. There are several bug reports at
http://bugs.sun.com/which complain about this fact (in most systems
there isn't any syscall or
function which will return this value correctly).
Erik could you try this ?
public static void main(String args[]) {
File adminHome = new File(PATH_TO_RES_ADMIN);
File aFile = null;
if (!adminHome.canWrite()) {
System.out.println("Problem found: canWrite returns false");
try {
aFile = File.createTempFile("prefix", "sufix", adminHome);
System.out.println("canWrite does not work as expected in
your environment, it returned false but the file " + aFile.getAbsolutePath()
+ " was created");
} catch (IOException e) {
System.out.println(PATH_TO_RES_ADMIN + " is actually
non-writable hence the server response. Exception: ");
e.printStackTrace();
}
} else {
try {
aFile = File.createTempFile("prefix", "sufix", adminHome);
System.out.println("This is not a java.io.File bug, we need
to check further.Created file was: " + aFile.getAbsolutePath());
} catch (IOException e) {
System.out.println("canWrite returns true but there was a
problem trying to create the file. Exception: ");
e.printStackTrace();
}
}
if (aFile != null) {
aFile.deleteOnExit();
}
}
2008/8/20 Erik Morton <ei...@gmail.com>
> Yes, silly typo. ./res/admin is a directory.
>
> I am able to get a file from ./res/admin, I just can't put a file there.
>
>
> On Aug 20, 2008, at 3:45 AM, Niklas Gustavsson wrote:
>
> Cool, you're the first case of using IPv6 with FtpServer that I've seen.
>>
>> On Tue, Aug 19, 2008 at 11:31 PM, Erik Morton <ei...@gmail.com> wrote:
>>
>>> I created a file called ./res/admin, which is chmod 777
>>>
>>
>> When you say "file", do you really mean a directory?
>>
>> /niklas
>>
>
>
Re: Problem getting the server working on MacOSX Leopard
Posted by Erik Morton <ei...@gmail.com>.
Yes, silly typo. ./res/admin is a directory.
I am able to get a file from ./res/admin, I just can't put a file there.
On Aug 20, 2008, at 3:45 AM, Niklas Gustavsson wrote:
> Cool, you're the first case of using IPv6 with FtpServer that I've
> seen.
>
> On Tue, Aug 19, 2008 at 11:31 PM, Erik Morton <ei...@gmail.com>
> wrote:
>> I created a file called ./res/admin, which is chmod 777
>
> When you say "file", do you really mean a directory?
>
> /niklas
Re: Problem getting the server working on MacOSX Leopard
Posted by Niklas Gustavsson <ni...@protocol7.com>.
Cool, you're the first case of using IPv6 with FtpServer that I've seen.
On Tue, Aug 19, 2008 at 11:31 PM, Erik Morton <ei...@gmail.com> wrote:
> I created a file called ./res/admin, which is chmod 777
When you say "file", do you really mean a directory?
/niklas