# ftp to localhost fails



## chigurh (Jan 25, 2013)

Hi, 

I have configured ftp/vsftpd and security/pam_pwdfile, my config files are as under - 

/usr/local/etc/vsftpd.conf

```
listen=YES
listen_address=10.0.0.30
listen_port=21
background=YES
max_clients=20
max_per_ip=5
pasv_min_port=50000
pasv_max_port=50999
guest_enable=YES
guest_username=virtual
anonymous_enable=NO
pam_service_name=vsftpd
local_enable=YES
write_enable=NO
local_umask=022
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
anon_world_readable_only=NO
dirmessage_enable=YES
xferlog_enable=YES
xferlog_file=/var/log/vsftpd.log
connect_from_port_20=YES
xferlog_std_format=YES
idle_session_timeout=600
ascii_upload_enable=NO
ascii_download_enable=NO
ftpd_banner=Welcome to 00oo00oo.l7.tk FTP service!
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
secure_chroot_dir=/usr/local/share/vsftpd/empty/
ls_recurse_enable=NO
```

/etc/pam.d/vsftpd

```
auth    required        /usr/local/lib/pam_pwdfile.so   pwdfile /usr/local/etc/vsftpd_login.db
account required        /usr/lib/pam_permit.so
```

My user account from /etc/passwd

```
matrix:*:1003:14:Matrix HW:/home/virtual/matrix:/bin/tcsh
```

Credentials /usr/local/etc/vsftpd_login.db

```
virtual:{SHA}AAXXXXXXXXXXXXXXXXXXXXX8=
matrix:{SHA}AAXXXXXXXXXXXXXXXXXXXXXX8=
```

I tried [CMD=]ftp matrix@10.0.0.30[/CMD] which errored 530 login failure -

```
<root@apogee>/root # ftp matrix@10.0.0.30
Connected to 10.0.0.30.
220 Welcome to apogee.fbsd.unx FTP service.
331 Please specify the password.
Password:
530 Login incorrect.
ftp: Login failed
ftp> quit
221 Goodbye.
```

However, I can sftp same account with same credentials. 
[CMD=]sftp matrix@10.0.0.30[/CMD]

```
sftp matrix@10.0.0.30
Password:
Connected to 10.0.0.30.
sftp> quit
```

Please let me know what needs to be done in order to connect to my box from ftp client.


----------



## SirDice (Jan 25, 2013)

sftp(1) uses ssh(1), it doesn't login on your vsftp service.


----------



## chigurh (Jan 25, 2013)

SirDice said:
			
		

> sftp(1) uses ssh(1), it doesn't login on your vsftp service.



Yeah I know, I wanted to say that my password is correct for the same user account.


----------



## SirDice (Jan 25, 2013)

I don't use vsftp but it looks like you configured it to use a separate accounts database, not the system's account database. So I think you need to use the password that's been set in vsftpd_login.db.


----------



## chigurh (Jan 25, 2013)

SirDice said:
			
		

> I don't use vsftp but it looks like you configured it to use a separate accounts database, not the system's account database. So I think you need to use the password that's been set in vsftpd_login.db.



I have same password for every user on my system and that password is hashed in vsftpd_login.db as well. Anyway I reconfigured it but it still doesn't work. I have checked security/pamtester and it returns the authentication error.


----------



## SirDice (Jan 25, 2013)

Have a read through this: http://unix-heaven.org/node/25

Looks like the same setup.


----------



## chigurh (Jan 26, 2013)

SirDice said:
			
		

> Have a read through this: http://unix-heaven.org/node/25
> 
> Looks like the same setup.



As a thumb rule I googled before posting in forum. Have tried several setups to no avail.


----------

