4 C
Texas
angeloma
Senior Writer and partner

How to configure a FTP server on OpenSUSE 15.1?

An FTP server is something basic when you set up a server. It is necessary because it allows us to transfer files to our server from our computer. As you can see it is very useful but requires a few small steps to achieve it. Therefore, today I will teach you how to configure a FTP server on OpenSUSE 15.1.

Configure a FTP server with vsftpd

vsftpd is a daemon that allows you to install and configure an FTP server. It is quite used for being very flexible in its configuration and secure. For example, it is the default in OpenSUSE and CentOS 7 but can be used in almost any Linux distribution.

Its configuration files are quite easy to understand because they are well documented. So this makes it the main option for our purpose.

So let us start.

Install and configure vsftpd on OpenSUSE 15.1

- Advertisement -

First, we must install it. The big advantage is that vsftpd is in the OpenSUSE repositories so we can install it using zypper.

:~$ sudo zypper in vsftpd

1.- install vsftpd
1.- install vsftpd

Now comes the configuration for everything to work properly.

The configuration file is this /etc/vsftpd.conf. If you open it you will see that it is very extensive, but it is because it has many commented lines. It is very well documented.

Before we edit it, let’s create a backup.

:~$ sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.bak

There are several things we need to edit.

:~$ sudo nano /etc/vsftpd.conf

Firstly, we must make the service “listen”. IPV4 and disable IPV6.

listen=YES
#listen_ipv6=NO

Then, allow writing.

write_enable=YES

There is a clause that defines port 20 as the default. I have commented on it and used the listen_port clause to define another port. For example, port 21. It can be the one you want.

#connect_from_port_20=YES
listen_port=21

It is very likely that if you work with FTP you will need to create users. To do this, it is necessary to cage them before creating them. That is to say, that each user cannot upload or download files from other users and even less from the system. In other words, they are isolated to their folder. To do this, add the following lines.

chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list

Then, create the file specified in chroot_list_file and add our system user there

:~$ sudo nano /etc/vsftpd.chroot_list
angelo

The pasv_min_port and pasv_max_port clauses define which ports FTP can use to be in passive mode. You have to work in the Firewall with them.

We can use the grep and cat commands to make the file more readable. With them I will show all the lines except the ones that start with a #.

:~$ sudo cat /etc/vsftpd.conf | grep -v "^#"

At this point, the configuration file would look more or less like this.

3.- The vfstpd config file
3.- The vfstpd config file

Now you have to open the necessary ports for vsftpd to work.

:~$ sudo firewall-cmd --add-port=21/tcp --permanent
Success
:~$ sudo firewall-cmd --add-port=30000-30100/tcp --permanent
Success
:~$ sudo firewall-cmd --reload
Success

Now let’s create the test user service.

:~$ sudo useradd -d /home/user1 -m -s /bin/bash user1
:~$ sudo passwd

Finally, you start the service and check its status.

:~$ sudo systemctl start vsftpd
:~$ sudo systemctl status vsftpd
● vsftpd.service - Vsftpd ftp daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled)
   Active: active (running) since Wed 2019-06-05 10:44:50 -04; 32min ago
 Main PID: 2888 (vsftpd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/vsftpd.service
           └─2888 /usr/sbin/vsftpd /etc/vsftpd.conf

The anonymous user is enabled by default. Its folder is /srv/ftp/ you can create alli files for download. You can even access it from your web browser. ftp://your-server/

4.- Access to the FTP server using the web browser
4.- Access to the FTP server using the web browser

Now, it’s time to install an FTP client. In this case I will use Filezilla.

Using Filezilla as the FTP client on OpenSUSE

First you have to install it.

:~$ sudo zypper in filezilla

Then you have to create the connection. To do this, go to the File menu and click on the Site Manager option. In the window that appears, configure your connection. I’ve done it this way.

5.- Creating a new FTP connection
5.- Creating a new FTP connection

And this is it. Now you can start enjoying the FTP server. Note that I’ve already uploaded a test file.

6.- Using FTP
6.- Using FTP

Enjoy it.

 

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article