Novell Home

ftpd on SUSE Linux Enterprise Server

Novell Cool Solutions: Feature
By Scott M. Morris

Digg This - Slashdot This

Posted: 20 Apr 2005
 

Cool Solutions Communities

Like what you see? Sign up for our weekly newsletter.

Want to contribute? It could earn you an iPod! Learn more.

Like wikis? Come participate in Cool Solutions' new wiki!

For many system administrators, it is convenient to have an anonymous FTP server. Customers, employees, and students alike can have easy access to spreadsheets, presentations, and other files with such a server. Thankfully, SUSE Linux Enterprise Server 9 comes with vsftpd, or Very Secure FTP Daemon, by default. Setting up this server for anonymous users will be the subject of this article.

Fortunately, 90% of the work is already done for us once the operating system itself is installed. All we have to do is copy a file, make a small edit in the vsftpd.conf file, and edit the runlevels. Don't worry, it only takes about 5 minutes to do all of this.

For this article, we will use a machine running KDE on SUSE Linux Enterprise Server 9, though other operating systems powered by SUSE Linux should work similarly. We will configure the FTP server to run when the machine boots.

Before we get too much further, let's make sure the FTP server is installed. Open YAST. Click on INSTALL AND REMOVE SOFTWARE on the right. When the next window comes up, type vsftpd into the SEARCH box, and click SEARCH. When the result comes up on the right, click in the box to install the package. Then, click on ACCEPT to perform the installation.

Now that we're sure it's installed, let's move on. The first thing let's do is tell the FTP server to run in stand-alone mode. Open up a terminal window. Become superuser, and edit the /etc/vsftpd.conf file. Vim is my text editor of choice. Use any text editor you like:

[1834][smorris@linux:~]$ su
Password:
linux:/home/smorris # vim /etc/vsftpd.conf

Go to the very end of the file, and uncomment the line that says, "# listen=YES" so that it says only, "listen=YES". When you are done with this, save the file and close the text editor.

Next, we need to make sure the FTP server will run when the machine boots. To do this, we'll make a small script. Go back to your terminal window. You should still be logged in as the superuser (if not, do it now). Edit a file called /etc/init.d/vsftpd:

[1834][smorris@linux:~]$ su
Password:
linux:/home/smorris # vim /etc/init.d/vsftpd

Copy and paste the following text into this file:

#!/bin/sh
case "$1" in
start)
    echo "Starting vsftpd ..."
    /usr/sbin/vsftpd &
    ;;
stop)
    echo "Stopping vsftpd ..."
    killall vsftpd
    ;;
*)
    echo "Usage: 'basename $0' {start|stop}" >&2
    exit 64
    ;;
esac
exit 0

Save and close the file. Still logged into the terminal window as superuser, we now have to make this file executable:

linux:/home/smorris # chmod +x /etc/init.d/vsftpd

Next, let's edit the system runlevels so our script gets executed when the machine boots next time.

Run YAST. From the left pane, select SYSTEM. From the right, select RUNLEVEL EDITOR:

The "Runlevel Editor: Services" window comes up. Select the EXPERT MODE radio button. Then, scroll down and select the vsftpd entry. Tick the '3' and '5' runlevel boxes. When you're done, click FINISH:

Now, let's test it. Restart the machine. When it comes back up, log in.

Open a terminal window and type ps aux | grep vsftp. You should see something similar to the output below:

[1834][smorris@linux:~]$ ps aux | grep vsftp
root      1325  0.0  0.0  1840  480 ?        S    16:07   0:00 /usr/sbin/vsftpd
root      1340  0.0  0.0  1220  268 ?        Ss   16:07   0:00 /sbin/startpar -f
smorris   4863  0.0  0.1  2588  688 pts/1    R+   16:08   0:00 grep vsftp
[1834][smorris@linux:~]$

You should see three lines. I had to cut off the second line so it would fit here, so yours may be longer. However, if you only see the last line, it has been set up incorrectly. Go back and check each of the instructions for accuracy.

Now, you may wish to test the server with your favorite FTP client. Keep in mind that when you connect in as an anonymous user, you have read-only access. Also, the FTP server root is /srv/ftp/, so that's where you'll place files you want people to be able to download.

If you need to have an anonymous FTP server set up quickly, SUSE Linux Enterprise Server 9 comes with vsftp which is a great choice. Several huge names in the industry use vsftp, such as ftp.suse.com, ftp.gnu.org, ftp.gnome.org, ftp.kde.org, ftp.kernel.org, ftp.ximian.com, and many others. When you want security, ease of use, and a quick setup, vsftp is the way to go.


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell