Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[gentoo-user] vsftpd anonymous upload illegal PORT command

53 views
Skip to first unread message

Walter Dnes

unread,
Aug 3, 2017, 8:20:04 AM8/3/17
to
I'm trying to upload files from an OS/2 VM in machine A to anononymous
upload on another machine on my home LAN. I'm using the allegedly "very
simple" ftpd and getting nowhere, and Google isn't helping. To simplify
things, I built vsftpd without ssl, and iptables is off on both
machines. I don't think it's related to PASV, because the ancient ftp
client on the OS/2 VM doesn't understand the "ftp -p" option. My
/etc/vsftpd/vsftpd.conf file is...

listen=YES
local_enable=NO
anonymous_enable=YES
anon_upload_enable=YES
write_enable=YES
anon_mkdir_write_enable=YES
anon_root=/home/ftp
pasv_enable=YES
pasv_min_port=30000
pasv_max_port=30100
port_enable=YES
allow_writeable_chroot=YES

I successfully log in as user "anonymous", password "anonymous",
execute "bin". When I try uploading a file, I get the 500 PORT error.
Anybody have a working config? Or another simpler ftpd server?

--
Walter Dnes <walt...@waltdnes.org>
I don't run "desktop environments"; I run useful applications

Jeriko One

unread,
Aug 3, 2017, 11:00:03 AM8/3/17
to


On 08/03/2017 05:13 AM, Walter Dnes wrote:
> I'm trying to upload files from an OS/2 VM in machine A to anononymous
> upload on another machine on my home LAN. I'm using the allegedly "very
> simple" ftpd and getting nowhere, and Google isn't helping. To simplify
> things, I built vsftpd without ssl, and iptables is off on both
> machines. I don't think it's related to PASV, because the ancient ftp
> client on the OS/2 VM doesn't understand the "ftp -p" option. My
> /etc/vsftpd/vsftpd.conf file is...
>
> listen=YES
> local_enable=NO
> anonymous_enable=YES
> anon_upload_enable=YES
> write_enable=YES
> anon_mkdir_write_enable=YES
> anon_root=/home/ftp
> pasv_enable=YES
> pasv_min_port=30000
> pasv_max_port=30100
> port_enable=YES
> allow_writeable_chroot=YES
>
> I successfully log in as user "anonymous", password "anonymous",
> execute "bin". When I try uploading a file, I get the 500 PORT error.
> Anybody have a working config? Or another simpler ftpd server?
>

Are you able to upload files from other machines than this particular
VM? I don't have any problems uploading using your config.

Who owns /home/ftp? I think by default vsftpd will change the owner to
root which would cause problems.

Mick

unread,
Aug 3, 2017, 11:10:05 AM8/3/17
to
On Thursday 03 Aug 2017 08:13:18 Walter Dnes wrote:
> I'm trying to upload files from an OS/2 VM in machine A to anononymous
> upload on another machine on my home LAN. I'm using the allegedly "very
> simple" ftpd and getting nowhere, and Google isn't helping. To simplify
> things, I built vsftpd without ssl, and iptables is off on both
> machines. I don't think it's related to PASV, because the ancient ftp
> client on the OS/2 VM doesn't understand the "ftp -p" option. My
> /etc/vsftpd/vsftpd.conf file is...
>
> listen=YES
> local_enable=NO
> anonymous_enable=YES
> anon_upload_enable=YES
> write_enable=YES
> anon_mkdir_write_enable=YES
> anon_root=/home/ftp

Is this writeable?

> pasv_enable=YES
> pasv_min_port=30000
> pasv_max_port=30100
> port_enable=YES
> allow_writeable_chroot=YES
>
> I successfully log in as user "anonymous", password "anonymous",
> execute "bin". When I try uploading a file, I get the 500 PORT error.
> Anybody have a working config? Or another simpler ftpd server?

For these kind of jobs I tend to default to netcat (nc) or socat in listening
mode, because of its simplicity. However, I am not familiar with OS/2 to know
what it comes with. If it has busybox or you can install it there you can use
busybox nc and/or busybox ftpd.

In answering your question, I think the error you are getting is related to
the client not using a passive connection type. Can you enable passive
*after* it connects?

ftp> passive
ls

Alternatives are the busybox ftpd service or tftp, both of which are
relatively easy to run.

--
Regards,
Mick
signature.asc

Walter Dnes

unread,
Aug 3, 2017, 3:10:03 PM8/3/17
to
On Thu, Aug 03, 2017 at 07:50:32AM -0700, Jeriko One wrote

> Are you able to upload files from other machines than this particular
> VM? I don't have any problems uploading using your config.

It fails uploading a test file from the linux machine hosting the VM.

> Who owns /home/ftp? I think by default vsftpd will change the owner
> to root which would cause problems.

I get more verbose error messages with the linux ftp client. On the h

[i3][root][/dev/shm] ftp 192.168.123.251
Connected to 192.168.123.251 (192.168.123.251).
220 (vsFTPd 3.0.2)
Name (192.168.123.251:waltdnes): anonymous
530 Please login with USER and PASS.
SSL not available
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> put hello.txt
local: hello.txt remote: hello.txt
200 PORT command successful. Consider using PASV.
553 Could not create file.
ftp> bye
221 Goodbye.

This was with the upload dir on 192.168.123.251 with permissions 555
[d531][root][~] ll /home/ftp/
total 8
dr-xr-xr-x 2 ftp ftp 4096 Aug 3 06:41 .
drwxr-xr-x 6 root root 4096 Aug 3 06:41 ..

If I change permissions on /home/ftp to 666, I get...

[i3][root][/dev/shm] ftp 192.168.123.251
Connected to 192.168.123.251 (192.168.123.251).
220 (vsFTPd 3.0.2)
Name (192.168.123.251:waltdnes): anonymous
530 Please login with USER and PASS.
SSL not available
331 Please specify the password.
Password:
500 OOPS: vsftpd: refusing to run with writable root inside chroot()
Login failed.
ftp> bye

How is this supposed to work anyways? Can't write to upload dir if
it's not writable, but vsftpd refuses to run if the upload dir is
writeable. Help.

Mick

unread,
Aug 3, 2017, 3:30:03 PM8/3/17
to
It could not create file because your ftp user:group do not have write
permission.


> If I change permissions on /home/ftp to 666, I get...
>
> [i3][root][/dev/shm] ftp 192.168.123.251
> Connected to 192.168.123.251 (192.168.123.251).
> 220 (vsFTPd 3.0.2)
> Name (192.168.123.251:waltdnes): anonymous
> 530 Please login with USER and PASS.
> SSL not available
> 331 Please specify the password.
> Password:
> 500 OOPS: vsftpd: refusing to run with writable root inside chroot()
> Login failed.
> ftp> bye
>
> How is this supposed to work anyways? Can't write to upload dir if
> it's not writable, but vsftpd refuses to run if the upload dir is
> writeable. Help.

According to the man page here:

https://security.appspot.com/vsftpd/vsftpd_conf.html

" ... the anonymous ftp user must have write permission on desired upload
locations."

You may want to try setting

file_open_mode=0777

in your vsftpd.conf and check ftp user or group have write permissions within
the /home/ftp/ directory.

--
Regards,
Mick
signature.asc

Bruce Schultz

unread,
Aug 3, 2017, 5:40:04 PM8/3/17
to
What about 777 for /home/ftp ?

Directories generally need the 'x' set
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Walter Dnes

unread,
Aug 3, 2017, 7:10:03 PM8/3/17
to
On Thu, Aug 03, 2017 at 04:09:15PM +0100, Mick wrote
> On Thursday 03 Aug 2017 08:13:18 Walter Dnes wrote:

> > anon_root=/home/ftp
>
> Is this writeable?

If I do make it writeable, I get...

500 OOPS: vsftpd: refusing to run with writable root inside chroot()

Damned if I do; damned if I don't.

> For these kind of jobs I tend to default to netcat (nc) or socat
> in listening mode, because of its simplicity. However, I am not
> familiar with OS/2 to know what it comes with. If it has busybox or
> you can install it there you can use busybox nc and/or busybox ftpd.

I'm trying to transfer a turn-based video game (Galactic Civilizations
2.5) from an OS/2 Warp 3.5 VM to modern, but backwards-compatible
ArcaOS5 https://www.arcanoae.com/arcaos/ atftpd seems to be the answer.
Both the old OS/2 and the new ArcaOS5 have a tftp client. I've got both
of them talking with atftpd on my Gentoo desktop, and it's transferring
data as I type.

Having said that, I really want to get an ftp server working, as a
matter of principle. Please post your vsftpd.conf, and the output of
"ls -al /home/ftp" to give me an idea of what I'm doing wrong.

David Haller

unread,
Aug 4, 2017, 9:20:04 PM8/4/17
to
Hello,

On Thu, 03 Aug 2017, Walter Dnes wrote:
>On Thu, Aug 03, 2017 at 04:09:15PM +0100, Mick wrote
>> On Thursday 03 Aug 2017 08:13:18 Walter Dnes wrote:
>
>> > anon_root=/home/ftp
>>
>> Is this writeable?
>
> If I do make it writeable, I get...
>
>500 OOPS: vsftpd: refusing to run with writable root inside chroot()

# mkdir /home/ftp/incoming
# chown ftp.ftp /home/ftp/incoming
# chmod 1777 /home/ftp/incoming
# chmod 555 /home/ftp

HTH,
-dnh

--
printk(KERN_CRIT PFX "Reboot didn't ?????\n");
linux-2.6.6/drivers/char/watchdog/softdog.c

Walter Dnes

unread,
Aug 7, 2017, 2:30:04 AM8/7/17
to
On Fri, Aug 04, 2017 at 02:23:08PM +0200, David Haller wrote
> Hello,
>
> On Thu, 03 Aug 2017, Walter Dnes wrote:
> >On Thu, Aug 03, 2017 at 04:09:15PM +0100, Mick wrote
> >> On Thursday 03 Aug 2017 08:13:18 Walter Dnes wrote:
> >
> >> > anon_root=/home/ftp
> >>
> >> Is this writeable?
> >
> > If I do make it writeable, I get...
> >
> >500 OOPS: vsftpd: refusing to run with writable root inside chroot()
>
> # mkdir /home/ftp/incoming
> # chown ftp.ftp /home/ftp/incoming
> # chmod 1777 /home/ftp/incoming
> # chmod 555 /home/ftp

I did the above (copy+paste; *WITHOUT* the "#", in case anyone asks).
Here's what happens. Question... why is it prompting me with "530 Please
login with USER and PASS." *AFTER* I give username "anonymous". BTW, if
I try any username, other than anonymous, it dies with a message about
being only an anonymous ftp server.

[i3][waltdnes][~/downloads] ftp -p 192.168.123.251
Connected to 192.168.123.251 (192.168.123.251).
220 (vsFTPd 3.0.2)
Name (192.168.123.251:waltdnes): anonymous
530 Please login with USER and PASS.
SSL not available
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> put install-x86-minimal-20170207.iso
local: install-x86-minimal-20170207.iso remote: install-x86-minimal-20170207.iso
227 Entering Passive Mode (192,168,123,251,117,59).
553 Could not create file.
ftp> bye
221 Goodbye.

I did manage to get the video game transferred with tftp, after a bit
of extra work. I don't know if it's the old OS/2 Warp tftp client, or
part of the protocol, but it can only transfer files up to 33553920
bytes in size, i.e. 32 * 1024 * 1024 - 512 bytes. 32 megabytes looks
like some sort of coded-in limit. I had to do the transfer in pieces
less than 32 megabytes. I still want to get anonymous ftp working.

Mick

unread,
Aug 7, 2017, 10:50:03 AM8/7/17
to
Sounds obvious, but did you try using a different client to connect to the ftp
server anonymously and see what you get?
--
Regards,
Mick
signature.asc

Walter Dnes

unread,
Aug 8, 2017, 12:30:03 AM8/8/17
to
On Mon, Aug 07, 2017 at 03:46:50PM +0100, Mick wrote

> > I did manage to get the video game transferred with tftp, after a bit
> > of extra work. I don't know if it's the old OS/2 Warp tftp client, or
> > part of the protocol, but it can only transfer files up to 33553920
> > bytes in size, i.e. 32 * 1024 * 1024 - 512 bytes. 32 megabytes looks
> > like some sort of coded-in limit. I had to do the transfer in pieces
> > less than 32 megabytes. I still want to get anonymous ftp working.
>
>
> Sounds obvious, but did you try using a different client to connect
> to the ftp server anonymously and see what you get?

I originally tried with the ancient OS/2 Warp ftp client from inside
the QEMU VM. Then I switched to testing the connection with net-ftp/ftp
from the Gentoo machine hosting the QEMU VM. The Gentoo client gives
more verbose error messages, but fails just like the ancient OS/2 Warp
ftp client.

David Haller

unread,
Aug 8, 2017, 7:20:04 PM8/8/17
to
Hello,

On Mon, 07 Aug 2017, Walter Dnes wrote:
>On Fri, Aug 04, 2017 at 02:23:08PM +0200, David Haller wrote
>> # mkdir /home/ftp/incoming
>> # chown ftp.ftp /home/ftp/incoming
>> # chmod 1777 /home/ftp/incoming
>> # chmod 555 /home/ftp
>
> I did the above (copy+paste; *WITHOUT* the "#", in case anyone asks).
>Here's what happens. Question... why is it prompting me with "530 Please
>login with USER and PASS." *AFTER* I give username "anonymous". BTW, if
>I try any username, other than anonymous, it dies with a message about
>being only an anonymous ftp server.
>
>[i3][waltdnes][~/downloads] ftp -p 192.168.123.251
>Connected to 192.168.123.251 (192.168.123.251).
>220 (vsFTPd 3.0.2)
>Name (192.168.123.251:waltdnes): anonymous
>530 Please login with USER and PASS.
>SSL not available
>331 Please specify the password.
>Password:
>230 Login successful.
>Remote system type is UNIX.
>Using binary mode to transfer files.

Try a:

ftp> cd incoming

here...


>ftp> put install-x86-minimal-20170207.iso

or use

ftp> put install-x86-minimal-20170207.iso incoming/

there.

>local: install-x86-minimal-20170207.iso remote: install-x86-minimal-20170207.iso
>227 Entering Passive Mode (192,168,123,251,117,59).
>553 Could not create file.
>ftp> bye
>221 Goodbye.

HTH,
-dnh

--
panic("floppy: Port bolixed.");
linux-2.2.16/include/asm-sparc/floppy.h

Walter Dnes

unread,
Aug 8, 2017, 10:10:06 PM8/8/17
to
> Try a:
>
> ftp> cd incoming

Thank you, that was it. I just pushed over a file from a Gentoo
machine to my desktop for a test. The OS/2 Warp ftp client still
doesn't work, but that's probably a VM networking issue. There are
other ways of getting data from inside the VM to the host machine, then
I can ftp from there.

Annoying "feature"... if I set "anon_root=/home/ftp/incoming/", then
vsftpd refuses to run, complaining about a writable chroot directory.
So I have to do an anonymous login, starting of in /home/ftp/ and then
manually "cd incoming".

David Haller

unread,
Aug 9, 2017, 10:40:05 AM8/9/17
to
Hello,

On Tue, 08 Aug 2017, Walter Dnes wrote:
>> Try a:
>>
>> ftp> cd incoming
>
> Thank you, that was it. I just pushed over a file from a Gentoo
>machine to my desktop for a test. The OS/2 Warp ftp client still
>doesn't work, but that's probably a VM networking issue. There are
>other ways of getting data from inside the VM to the host machine, then
>I can ftp from there.
>
> Annoying "feature"... if I set "anon_root=/home/ftp/incoming/", then
>vsftpd refuses to run, complaining about a writable chroot directory.

Yeah, it's all about the writeable root (of the chroot). Whichever
path that is. Writeable chroot-root is just a "no-no" ;) And having
those rights on /incoming is quite sane...

>So I have to do an anonymous login, starting of in /home/ftp/ and then
>manually "cd incoming".

Or just add the target-dir at the end of the 'put foo /incoming/'.

And have a look at your client configuration ... For the plain
net-ftp/ftp client, it's ~/.netrc (see 'man 5 netrc'). Uhhm, that's
not quite intuitive to use... So here's a working example:

==== ~/.netrc ====
machine localhost
login anonymous password "test@localhost"
macdef init
pwd
cd /incoming
pwd


default login anonymous password "inv...@invalid.invalid"
====

That way, you'd be auto-logged-in and auto-chdired to incoming on
localhost. Ain't that nice? You could add more commands to that
init-macro... Like a 'put foo' ;) Add a host-alias to your /etc/hosts
use that for a 'machine foo' directive in your .netrc and *tada* all
can be automated ;) That's Unix: a large box of pieces that can all
be combined creatively - or less so.

The 'pwd' are just for debugging (and the macro-definition (here the
special init macro) ends at the empty line). That should get you
started :)

Anyway, TUI/GUI clients like ncftp and gftp often have similar
features... Or even read ~/.netrc.

HTH,
-dnh, lovin' it to know the basics, learned in the 90ies, still valid
today ...

--
Truth's a bitch. -- Beka Valentine, Andromeda 3x04 - "Cui Bono"
0 new messages