# Grrr, FTP

## IainCE

Sigh, I've been trying for days to get an FTP server set up (because my file transfer doesn't work on aMSN for some reason - any ideas on that, post them please).

Well I tried vsftpd and did the following steps.

```

emerge vsftpd

cp /etc/vsftpd/vsftpd.conf.sample /etc/vsftpd/vsftpd.conf

groupadd ftpgroup

useradd -g ftpgroup -d /home/ftp -p password ftpuser

added background=YES and listen=YES to /etc/vsftpd/vsftpd.conf

/etc/init.d/vsftpd start

```

And all that went okay.  When my friend tries to connect to me, he gets this error: http://djh-world.com/iain/untitled.png

It's really annoying me now, no matter what I do he always gets that error.

Are there any ideas which means FTP is not working?  I've tried loads.   :Mad: 

Thanks, Iain.

----------

## papal_authority

Can you ftp locally from the command line (e.g. ftp localhost)? Just a thought to ensure it's actually running...

----------

## IainCE

How?   :Embarassed: 

I tried this (if this is what you wanted me to do)

```

root@pc1 iain # telnet 127.0.0.1 21

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is '^]'.

500 OOPS: vsftpd: cannot locate user specified in 'ftp_username':ftp

Connection closed by foreign host.

```

----------

## papal_authority

Can't you just:

```
% ftp 127.0.0.1
```

It sounds like you need to add the user "ftp" (i.e. not "ftpuser") to your system. I haven't used used vsftpd recently but IIRC you'll also want to ensure you have these lines in your vsftpd.conf file:

```
anonymous_enable=YES

local_enable=YES
```

----------

## IainCE

'ftp' doesn't work...

```

root@pc1 iain # ftp 127.0.0.1

bash: ftp: command not found

```

So that's why I tried telnet.

I added those lines too but anonymous_enable gives an error...

```

root@pc1 iain # /etc/init.d/vsftpd start

 * Starting vsftpd...

500 OOPS: bad bool value in config file for: anonymous_enable             [ !! ]

```

But now with that local_enable telnet now replies:

```

root@pc1 iain # telnet 127.0.0.1 21

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is '^]'.

220 (vsFTPd 1.2.2)

```

Which looks positive?  It still doesn't work for my friends to try and connect to me though.   :Confused: 

Any stupid mistakes I could have made?   :Razz:  (I did useradd...ftp like you said..)

Thanks.

----------

## papal_authority

Oh sorry, to get commandline FTP you need to do a:

```
# emerge -v ftp
```

It's a quick build  :Very Happy: 

Maybe remove the anonymous_enable line then if it's producing errors as apparently YES is the default:

 *man 5 vsftpd.conf wrote:*   

> anonymous_enable
> 
>     Controls whether anonymous logins are permitted or not. If enabled, both the usernames ftp and anonymous are recognised as anonymous logins.
> 
>     Default: YES

 

I'd ensure the localhost works flawlessly before debugging remote hosts...

----------

## IainCE

```

root@pc1 iain # ftp 127.0.0.1

Connected to 127.0.0.1.

220 (vsFTPd 1.2.2)

Name (127.0.0.1:iain):

```

I know it might sound like a stupid question, but what do I type in to get anonymous access?   :Embarassed:   I'm pretty new to FTP servers.

Thanks for getting me this far.   :Very Happy: 

----------

## papal_authority

Login as "ftp" and the password should be "password" (or whatever you typed  in the useradd phase). You should also be able to login with your own user name (i.e. "iain") and your own password. Then you can "LS" and "GET filename"  :Very Happy: 

----------

## IainCE

Woo, I can log in using my own username and password and it takes me to my home dir.   :Very Happy:  It doesn't work for my mate though using Explorer.

When I try 'ftp' and 'password' it returns...

```

iain@pc1 iain $ ftp 127.0.0.1

Connected to 127.0.0.1.

220 (vsFTPd 1.2.2)

Name (127.0.0.1:iain): ftp

530 Please login with USER and PASS.

SSL not available

331 Please specify the password.

Password:

500 OOPS: vsftpd: refusing to run with writable anonymous root

Login failed.

421 Service not available, remote server has closed connection

ftp>

```

Sorry for being so useless and asking so many questions.   :Razz: 

----------

## papal_authority

Sounds like the home directory of the ftp user is writable. Maybe do a:

```
chmod 0500 /home/ftp
```

This is of course assuming you don't want your friend uploading. Hey no problems with the questions, that's what these forums are for  :Very Happy: 

----------

## IainCE

Okay thanks for your help.  That got rid of that error.   :Very Happy: 

It has been a long day, so I'll pick up where I am tomorrow I think.  Trying to do something when tired never quite works.   :Razz: 

```

iain@pc1 iain $ ftp 127.0.0.1

Connected to 127.0.0.1.

220 Iain's FTP server

Name (127.0.0.1:iain): ftp

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> ls

200 PORT command successful. Consider using PASV.

150 Here comes the directory listing.

226 Transfer done (but failed to open directory).

```

Nearly there.   :Cool:   Cheers.

----------

