User login

Installing and using FTP on Debian

So I needed FTP in a pinch.

PureFTP was the first that got me to the install instructions:
http://www.debianhelp.co.uk/pureftp.htm

sudo apt-get install pure-ftpd-common pure-ftpd
sudo groupadd ftpgroup
sudo useradd -g ftpgroup -d /dev/null -s /etc ftpuser
sudo pure-pw useradd agaric -u ftpuser -d /home/ftpusers/agaric
sudo pure-pw mkdb

It appeared to be successful.

So I set up FTP on my Debian server. Now what? How do we actually connect to it?

The username and password I set up is rejected logging in.

Taking this from the top, with more detail:

Installing PureFTP on Debian Etch

Picked inetd:

Using inetd is a suitable option for small ftp servers because the inetd super-server will only launch pure-ftpd to handle incoming connections. Standalone operation is more efficient for busy ftp sites.

Also left at the default for the setuid question:

The pure-ftpwho program only works with root privileges. Since it's a fairly trivial program, this poses little security risk. Still, it is only recommended that you install any program setuid root if you need it.

You can always change your mind later by reconfiguring this package with "dpkg-reconfigure pure-ftpd-common".

Do you want pure-ftpwho to be installed setuid root?

For "Enable virtual chroots ?" stayed with No.

FTP with MySQL back-end

That idea is canceled. It can't be effortlessly tied to the ISP-style email database (new fields need to be added, gid and stuff) so we'll just manage database users directly.

debian get user info

debian show user
debian show user information
http://www.cae.wisc.edu/site/public/?title=linaccounts

ben@server:~$ sudo aptitude install pure-ftpd-common pure-ftpd

ben@server:~$ sudo groupadd ftpgroup
groupadd: group ftpgroup exists
ben@server:~$ sudo useradd -g ftpgroup -d /dev/null -s /etc ftpuser
useradd: user ftpuser exists

Sigh. Trying to get a look at user account information, see if it matches above:

ben@server:~$ sudo vi /etc/shadow

ftpuser:!:13785:0:99999:7:::

Umm... Let's just get rid of them.

NOTE: Probably should have used sudo deluser --remove-home ftpuser or sudo userdel -r ftpuser

ben@server:~$ sudo userdel ftpuser
ben@server:~$ sudo delgroup ftpgroup
Removing group `ftpgroup' ...
Done.

Doing a thorough job of it:

ben@server:~$ sudo deluser --remove-home ftp
Looking for files to backup/remove ...
Removing files ...
Removing user ftp' ...
Done.
ben@server:~$ sudo deluser --remove-home proftpd
Looking for files to backup/remove ...
Not backing up/removing
/var/run/proftpd', it matches ^/var/.*.
Removing user `proftpd' ...
Done.

(Note that the proftpd package was removed by the pureftp installation.)

ben@server:~$ sudo groupadd ftpgroup
ben@server:~$ sudo useradd -g ftpgroup -d /dev/null -s /etc ftpuser
ben@server:~$ sudo pure-pw useradd files -u ftpuser -d /home/ftpusers/files
Password:
Enter it again:
You didn't enter the same password
Password:
Enter it again:
ben@server:~$ sudo pure-pw mkdb

ben@server:~$ sudo /usr/sbin/pure-ftpd &
[2] 4568
[1]   Exit 1                  sudo /usr/local/sbin/pure-ftpd

ben@server:/etc/pure-ftpd/auth$ sudo /etc/init.d/pure-ftpd stop
Stopping ftp server: pure-ftpd.
ben@server:/etc/pure-ftpd/auth$ sudo netstat -ap | grep "*:ftp"
   
tcp        0      0 *:ftp                   *:*                     LISTEN     4568/pure-ftpd (SER
tcp6       0      0 *:ftp                   *:*                     LISTEN     4568/pure-ftpd (SER
ben@server:/etc/pure-ftpd/auth$
ben@server:/etc/pure-ftpd/auth$ sudo /usr/sbin/pure-ftpd &
[3] 4819
ben@server:/etc/pure-ftpd/auth$ Unable to start a standalone server: Address already in use
ben@server:/etc/pure-ftpd/auth$ sudo fuser -n tcp 21
21/tcp:               4568
[3]+  Done                    sudo /usr/sbin/pure-ftpd
ben@server:/etc/pure-ftpd/auth$ sudo kill 4568
[2]+  Done                    sudo /usr/sbin/pure-ftpd  (wd: ~)
(wd now: /etc/pure-ftpd/auth)
ben@server:/etc/pure-ftpd/auth$ sudo fuser -n tcp 21

OK, so finally getting it to work involved following these instructions below, except that I also had to kill the pure-ftpd process manually in order to restart it.

From http://ubuntuforums.org/archive/index.php/t-9936.html
<blockquote>
I got it to work. Most of this stuff is documented here: http://download.pureftpd.org/pub/pure-ftpd/doc/README.Virtual-Users
and from previous posts in this thread. I just needed to condense it so you guys could know which step I'm talking about. This is instruction for installing pure-ftpd on a newly installed dapper installation.

You might not need pureadmin but if you're using a desktop environment I would definitely think about installing this as the graphical front-end.

# sudo -s
# apt-get install pure-ftpd pureadmin

Create the user and group accounts:

# groupadd ftpgroup
# useradd -g ftpgroup -d /dev/null -s /etc ftpuser
# pure-pw useradd NAME -u ftpuser -d /DIRECTORY
Type in the password when prompted for the new user twice.

NAME and DIRECTORY can be whatever you want them to be.

Create the database and make sure that the pure-ftpd configuration strictly uses the pdb file for managing accounts:

# pure-pw mkdb
# ln -s /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/PureDB
# gedit /etc/pure-ftpd/conf/PAMAuthentication
Change yes into no

Make sure that a backup file (.PAMAuthentication~) isn't created because it will create a conflict when trying to restart service. Using PAM can allow public access to administrative accounts using pure-ftpd, that's why I disable it within pure-ftpd. I prefer it off so I can strictly use virtual accounts maintained within the pdb file.

Finally it's time to enable the pdb file and yes you do have to stop the server in order to avoid errors stating that the port is already in use.

# /etc/init.d/pure-ftpd stop
# /usr/sbin/pure-ftpd -j -lpuredb:/etc/pure-ftpd/pureftpd.pdb &
# /etc/init.d/pure-ftpd start

It works great and is very simple to administer with PureAdmin. Most of the virtual user creation can be done there. Saves a lot of time. The visual log helps out a bit too.
</blockquote>

AND testing with FTP, not SFTP – SFTP does not work.

ben@server:/etc/pure-ftpd/auth$ sudo vi /etc/pure-ftpd/conf/PureDB
ben@server:/etc/pure-ftpd/auth$ sudo kill 5108
[1]+  Done                    sudo /usr/sbin/pure-ftpd -j -lpuredb:/etc/pure-ftpd/pureftpd.pdb
ben@server:/etc/pure-ftpd/auth$ sudo /usr/sbin/pure-ftpd -j -lpuredb:/etc/pure-ftpd/pureftpd.pdb &
[1] 5168
ben@server:/etc/pure-ftpd/auth$ sudo /etc/init.d/pure-ftpd start
Starting ftp server: Running: /usr/sbin/pure-ftpd -l puredb:/etc/pure-ftpd/pureftpd.pdb -l puredb:/etc/pure-ftpd/pureftpd.pdb -O clf:/var/log/pure-ftpd/transfer.log -E -u 1000 -B
ben@server:/etc/pure-ftpd/auth$ sudo pure-pw passwd files
Password:
Enter it again:

In this case I knew the first password request would be for sudo:

ben@server:~$ sudo pure-pw useradd agftp -u ftpuser -d /home/ftpusers/agftp
Password:
Password:
Enter it again:
ben@server:~$ sudo pure-pw mkdb

DON'T FORGET pure-pw mkdb OR IT WON'T WORK.

(with the -m flag, should not need pure-pw mkdb afterward)
sudo pure-pw passwd md -m

giving a user access to their site's themes and modules folders:

<code>
cd /var/www/drupal-5_3-live/sites/mdd.openzuka.net/
sudo mv themes/ /home/ftpusers/md/
sudo ln -s /home/ftpusers/md/themes themes
sudo mkdir /home/ftpusers/md/modules
sudo ln -s /home/ftpusers/md/modules modules
sudo chown -R ftpuser:ftpgroup /home/ftpusers/md/


sudo pure-pw userdel mdd
sudo pure-pw show mdd

Unable to fetch info about user [mdd] in file [/etc/pure-ftpd/pureftpd.passwd]

(only shows current activity--)
sudo pure-ftpwho

References:

http://www.novell.com/coolsolutions/feature/19818.html
http://download.pureftpd.org/pub/pure-ftpd/doc/README
http://www.debianhelp.co.uk/pureftp.htm
http://www.linuxquestions.org/questions/linux-server-73/pureftp-user-accounts-499141/
http://www.howtoforge.com/virtual_hosting_pureftpd_mysql_mandriva2007_spring

Resolution

Searched words: 
debian ftp setup debian Etch ftp setup connect to pureFTP pureftp login always fails quit pureftp pureftp database backend for users pure ftpd pure-ftpd

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.