# ftp server



## hirohitosan (Dec 21, 2008)

I have problems with my ftp server.

I installed pure-ftpd server but maybe something went wrong since I cannot connect through ftp.


```
Connected to my.ftp.server.
220---------- Welcome to Pure-FTPd [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 09:12. Server port: 21.
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
331 User user OK. Password required
Password:
530 Login authentication failed
ftp: Login failed.
ftp>
```

and I'm sure I gave the right psw


```
# pkg_info pure-ftpd
pkg_info: can't find package 'pure-ftpd' installed or in a file!
```
and 
	
	



```
# ps ax
.
.
.
21286  ??  Is     0:00.02 pure-ftpd (SERVER) (pure-ftpd)
```

how can I fix this problem? where is the problem?

PS
I also try 
	
	



```
$ ftp localhost
Connected to localhost.
220---------- Welcome to Pure-FTPd [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 09:25. Server port: 21.
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
Name (localhost:user): user
331 User horatiu OK. Password required
Password:
530 Login authentication failed
ftp: Login failed.
```

thanks


----------



## dclau (Dec 21, 2008)

hirohitosan said:
			
		

> ```
> # pkg_info pure-ftpd
> pkg_info: can't find package 'pure-ftpd' installed or in a file!
> ```


Try this:
	
	



```
pkg_info | grep pure
```
Also double-check the config file (if you use one) or the command used when you start your ftp server. I think you have something misconfigured there.

The README says:


> Unlike many daemons, Pure-FTPd doesn't read any configuration file (but for
> LDAP and SQL). Instead, it uses command-line options.
> ...
> If you want to use a configuration file with Pure-FTPd, you can, through
> ...


----------



## hirohitosan (Dec 21, 2008)

dclau said:
			
		

> I think you have something misconfigured there.



Me too but I don't find any configuration file. Don't know where to search.

and 
	
	



```
pkg_info | grep pure
pure-ftpd-1.0.21_2  A small, easy to set up, fast and very secure FTP server
```

at least how can I deinstall and install again?


----------



## dclau (Dec 21, 2008)

```
sudo pkg_delete pure-ftpd-1.0.21_2
```
Or as _root_, without the _sudo_ part.


----------



## dclau (Dec 21, 2008)

I attached a sample of (untouched) configuration file. It is very well commented, i hope it'll help.


----------



## danger@ (Dec 22, 2008)

the configuration file should be located in /usr/local/etc/


----------



## dclau (Dec 22, 2008)

danger@ said:
			
		

> the configuration file should be located in /usr/local/etc/



If you run _pure-config.pl /path/to/your/config_ it doesn't really matter where you put the configuration file, i guess, but you're right, when installed from ports the config file goes there.


----------



## SaveTheRbtz (Dec 22, 2008)

I can be wrong but pure-ftpd can refuse login if something wrong with ftp folder ( does not exists / wrong permitions )
for more information check pure-ftpd's log

PS. From the beginning all pure-ftpd's setting passed as command line parameters, and all so-called config files are just merely hacks / parsers.


----------



## hirohitosan (Dec 22, 2008)

Thanks guys!
I deinstall pure-ftpd and install it again.

How can I automatically run the server when the system boots?

In pure-ftpd documentation says:


> add the command
> 
> /usr/local/sbin/pure-ftpd &
> 
> to /etc/rc.d/rc.local or /etc/rc.d/boot.local . Don't forget the '&' sign.


but I don't have /etc/rc.d/rc.local or /etc/rc.d/boot.local 

thanks


----------



## tingo (Dec 22, 2008)

hirohitosan said:
			
		

> How can I automatically run the server when the system boots?



Most (ok, many) FreeBSD ports use a variable in /etc/rc.conf file of the form portname_enable="YES" to enable the port. Coupled with a startup script in /usr/local/etc/rc.d, the port will be started when FreeBSD starts up.
For pureftpd, I believe the needed entry in /etc/rc.conf is:
pureftpd_enable="YES"

Hope this helps. 
Oh, one more thing: you can usually run
/usr/local/etc/rc.d/scriptname rcvar
to find out which variables a script supports.


----------



## hirohitosan (Dec 22, 2008)

here what I have in /usr/local/etc/rc.d:

```
# ls /usr/local/etc/rc.d
020named.sh             courier-imap-imapd-ssl  postgresql
040exim.sh              courier-imap-pop3d      proftpd
050proftpd.sh           courier-imap-pop3d-ssl  pure-authd.sh
080cpanel4.sh           dovecot                 pure-ftpd
090chkservd.sh          exim                    rsyncd
apache22                htcacheclean            stunnel
chkservd.sh             httpd                   webmin
```
I did:

```
# /usr/local/etc/rc.d/pure-ftpd rcvar
# pureftpd
$pureftpd_enable=YES
```

and I add in
/etc/rc.conf

pureftpd_enable="YES"

but after rebooting the server still not start


----------



## edogawaconan (Dec 28, 2008)

what's in your /usr/local/etc/pure-ftpd.conf ?


----------



## hirohitosan (Jan 9, 2009)

edogawaconan said:
			
		

> what's in your /usr/local/etc/pure-ftpd.conf ?


I put in attachment the pure-ftpd.conf file


----------



## trev (Jan 10, 2009)

The /etc/rc.conf edit you made has no effect unless you've also written, or otherwise have, an extended application startup script in /usr/local/etc/rc.d/ similar to:


```
#!/bin/sh

# PROVIDE: pureftpd
# REQUIRE: NETWORKING SERVERS
# BEFORE: DAEMON
# KEYWORD: shutdown

#
# Add the following lines to /etc/rc.conf to enable pure-ftpd:
#
# pureftpd_enable="YES"
#
# For launch uploadscript daemon define
# pureftpd_upload_enable="YES"
# pureftpd_uploadscript="/full/path/to/launch_script"
#

. /etc/rc.subr

name=pureftpd
rcvar=`set_rcvar`

load_rc_config $name

command=/usr/local/sbin/pure-config.pl
command_upload=/usr/local/sbin/pure-uploadscript
pureftpd_uploadscript=${pureftpd_uploadscript:-"/usr/bin/touch"}
pureftpd_config=${pureftpd_config:-"/usr/local/etc/pure-ftpd.conf"}
required_files=${pureftpd_config}
pidfile=/var/run/pure-ftpd.pid
pidfile2=/var/run/pure-uploadscript.pid
procname=pure-ftpd

pureftpd_enable=${pureftpd_enable:-"NO"}
command_args=${pureftpd_config}
command_upload_args="-B -r ${pureftpd_uploadscript}"

start_postcmd=start_postcmd
stop_postcmd=stop_postcmd

start_postcmd()
{
       if test -n ${pureftpd_upload_enable:-""} && checkyesno pureftpd_upload_enable; then
       echo "Starting ${command_upload}."
       ${command_upload} ${command_upload_args}  
       fi
}

stop_postcmd()
{
        if test -n ${pureftpd_upload_enable:-""} && checkyesno pureftpd_upload_enable; then
        pid=$(check_pidfile ${pidfile2} ${command_upload})
        if [ -z ${pid} ]; then
        echo "Upload script not running? (check ${pidfile2})."
        return 1
        fi
        echo "Stopping ${command_upload}."
        kill -${sig_stop:-TERM} ${pid}
        [ $? -ne 0 ] && [ -z "$rc_force" ] && return 1
        wait_for_pids ${pid}
        fi
}

run_rc_command "$1"
```


----------

