How To Setup FTP Server On openSUSE 13.2/13.1

This tutorial will describe how to install and configure a basic simple FTP server on openSUSE 13.2/13.1 using VSFTD.

vsftpd (Very Secure File Transport Protocol Daemon) is a secure, fast FTP server for Unix/Linux systems.

Install vsftpd

Login as root user using command:

su

Enter the following the following command to vsftpd package.

zypper in vsftpd

Start vsftpd service, and make it to start automatically on every reboot.

systemctl enable vsftpd
systemctl start vsftpd

Configure vsftpd

Create a folder for ftp users.

mkdir /srv/ftp

Create a group called ftp-users.

groupadd ftp-users

Create a sample user called unixmen with home directory /srv/ftp/, and assign the user to ftp-users group.

useradd -g ftp-users -d /srv/ftp/ unixmen

Set password for the new user.

passwd unixmen

Make the ftp home directory /srv/ftp/ accessible by ftp users.

chmod 750 /srv/ftp/
chown unixmen:ftp-users /srv/ftp/

Edit file vsftpd.conf,

nano /etc/vsftpd.conf

Make the changes as shown below.

[...]
# Uncomment and  Set YES to enable write.
write_enable=YES
[...]
# Uncomment and Set banner name for your website
ftpd_banner=Welcome to Unixmen FTP service.
[...]
# Uncomment
ls_recurse_enable=YES
[...]
# Uncomment and set YES to allow local users to log in.
local_enable=YES
[...]
# To disable anonymous access, set NO.
anonymous_enable=NO
[...]
# Uncomment to enable ascii download and upload.
ascii_upload_enable=YES
ascii_download_enable=YES
[...]
## Add at the end of this  file ##
use_localtime=YES

Save and exit file.

Test FTP Server in the local system itself

First let us try to login to our FTP server as shown below.

ftp localhost

Sample Output:

Trying ::1:21 ...
Connected to localhost.
220 (vsFTPd 3.0.2)
Name (localhost:skopensuse): unixmen  ## FTP user name
331 Please specify the password.
Password:   ## FTP user password
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>

As you in the above output, we will be able to login to ftp server using unixmen user. Type quit to exit from ftp console.

Test FTP Server from a remote system

By default, openSUSE built-in firewall won’t allow to login to FTP from remote systems. So let us allow vsftpd service through suse firewall. To do that go to Yast -> Security and Users -> Firewall.

YaST Control Center @ linux.site_001

In the Firewall section, go to Allowed Services. In the zone selection drop down box, select External Zone and in Service to Allow drop-down box, select vsftpd server and click add.

YaST2_002

Click Next, and close Yast Control center.

Now, try to connect from a remote system.

In my case, I tried from my Ubuntu desktop.

ftp 192.168.1.150

Sample output:

Connected to 192.168.1.150.
220 (vsFTPd 3.0.2)
Name (192.168.1.150:sk): unixmen
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>

As you see in the above output, I will be able to connect to FTP server. If you didn’t allow the vsftpd service through firewall, you may get a Connection timed out error.

Connect from Browser

Open up your browser and Navigate to ftp://ip-address/. Enter the ftp user name and password.

New Tab - Mozilla Firefox_001

Index of ftp:--192.168.1.150- - Mozilla Firefox_002

Connect to FTP server using FileZilla

Working from command-line mode might be little bit annoying to newbies. So let us install a graphical FTP client called Filezilla to get things done quite easier:

Mostly, fileZilla is available on almost all Linux distributions default repositories.

On Ubuntu based systems:

sudo apt-get install filezilla

On Fedora/Redhat systems:

sudo yum install filezilla

On openSUSE/SUSE:

zypper in filezilla

After installing filezilla, open it, and enter the ftp server IP address, user name and password and click quickconnect.

FileZilla_003

unixmen@192.168.1.150 - FileZilla_004

For added security, you can restrict FTP access to certain users by adding them to /etc/vsftpd.chroot_list file.

Edit vsftpd.conf file,

nano /etc/vsftpd.conf

Make the changes as shown below.

[...]
# Uncomment and set YES
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
[...]

Create a new file /etc/vsftpd.chroot_list,

nano /etc/vsftpd.chroot_list

Add the users that you want to give access to FTP server. I added the user called unixmen.

unixmen

Restart ftp service.

systemctl restart vsftpd

Now you will be able to connect to FTP server with users in the chroot list file.

If you try to connect to FTP server with users other than in the chroot list, you may get the following error:

500 OOPS: could not read chroot() list file:/etc/vsftpd.chroot_list
ftp: Login failed

That’s it. Your FTP server is ready to use.

Cheers!