• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

How to install and configure Secure FTP server in Ubuntu 12.04 LTS

May 21, 2013 by Sharad Chhetri 2 Comments

In this tutorial we will learn how to install and configure VSFTP server.In this practical we will disable the Anonymous login and will allow system user to login with password.

This tutorial is 2nd part of the post How to install and configure FTP server in Ubuntu 12.04 LTS

Note: We will install the vsftpd 3.0 package after downloading it into the system.
We are not going to use “apt-get install” method .
The reason it has bug related to chroot enable.
For reference :
https://sharadchhetri.com/2013/05/20/500-oops-vsftpd-refusing-to-run-with-writable-root-inside-chroot

To install and configure the FTP Server ,follow the given below steps

Step 1 : Login with superuser and download and install vsftpd package

    tux@ubuntu:~$ sudo su -
    [sudo] password for tux:
    root@ubuntu:~#
    root@ubuntu:~# cd /root/
    root@ubuntu:~# wget http://security.ubuntu.com/ubuntu/pool/main/v/vsftpd/vsftpd_3.0.2-1ubuntu2_i386.deb
    –2013-05-20 09:36:20– http://security.ubuntu.com/ubuntu/pool/main/v/vsftpd/vsftpd_3.0.2-1ubuntu2_i386.deb
    Resolving security.ubuntu.com (security.ubuntu.com)… 91.189.92.190
    , 91.189.92.201, 91.189.92.202, …
    Connecting to security.ubuntu.com (security.ubuntu.com)|91.189.92.190|:80… connected.
    HTTP request sent, awaiting response… 200 OK
    Length: 114714 (112K) [application/x-debian-package]
    Saving to: `vsftpd_3.0.2-1ubuntu2_i386.deb’

    100%[=========================================================================================>] 114,714 219K/s in 0.5s

    2013-05-20 09:36:21 (219 KB/s) – `vsftpd_3.0.2-1ubuntu2_i386.deb’ saved [114714/114714]

    root@ubuntu:~#
    root@ubuntu:~#
    root@ubuntu:~# dpkg -i vsftpd_3.0.2-1ubuntu2_i386.deb
     
    Install the dependency of vsftpd

      root@ubuntu:~# apt-get install libcap2

Step 2 : Backup the vsftpd.conf file and edit the given below parameters in vsftpd.conf file.Then restart the vsftpd service.

# cp -p /etc/vsftpd.conf.dpkg-new /etc/vsftpd.conf
# cp -p /etc/vsftpd.conf /etc/vsftpd.conf.orig
# vi /etc/vsftpd.conf

anonymous_enable=NO
local_enable=YES
write_enable=YES

# service vsftpd restart

Note: You can create directly /etc/vsftpd.conf file rather than following just above given steps. Below section has my vsftpd.conf file settings, you can copy and paste the content in your server /etc/vsftpd.conf file.

My /etc/vsftpd.conf is configured like this

root@ubuntu:~# egrep -v '^#|^$' /etc/vsftpd.conf
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
root@ubuntu:~# 

Step 3: Now login into FTP server with command line ,web browser or using FTP client(filezilla) .
Give System username and password.After login you can start downloading and uploading the files into FTP server
Note: Bydefault user will login into its home directory (eg. /home/joe)

Below is eg. with command line

linux@tuxworld:/tmp$ ls -l
total 24
drwx------ 2 linux   linux   4096 May 21 07:35 CRX_75DAF8CB7768
drwxrwxr-x 2 linux   linux   4096 May 21 07:18 emptydir
drwx------ 2 linux   linux   4096 May 21 07:27 pulse-0VcDFPK5pDDt
drwx------ 2 lightdm lightdm 4096 May 19 07:49 pulse-2L9K88eMlGn7
drwx------ 2 root    root    4096 May 19 07:48 pulse-PKdhtXMmr18n
drwxrwxr-x 2 linux   linux   4096 May 21 07:19 testdir
-rw-rw-r-- 1 linux   linux      0 May 21 07:19 testfile1
-rw-rw-r-- 1 linux   linux      0 May 21 07:19 testfile2
-rw-rw-r-- 1 linux   linux      0 May 21 07:19 testfile3
-rw-rw-r-- 1 linux   linux      0 May 21 07:19 testfile4
linux@tuxworld:/tmp$ 
linux@tuxworld:/tmp$ ftp 10.10.0.25
Connected to 10.10.0.25.
220 (vsFTPd 3.0.2)
Name (10.10.0.25:linux): tux
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> put testfile1
local: testfile1 remote: testfile1
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 Transfer complete.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-------    1 1000     1000            0 May 20 11:46 testfile1
-rw-------    1 1000     1000       231190 May 20 05:26 ubuntu.jpg
-rw-r--r--    1 1000     1000       199818 May 20 06:05 vsftpd_3.0.2-2_all.deb
226 Directory send OK.
ftp> mput testfile2 testfile3 testfile4
mput testfile2? y
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 Transfer complete.
mput testfile3? y
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 Transfer complete.
mput testfile4? y
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 Transfer complete.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-------    1 1000     1000            0 May 20 11:46 testfile1
-rw-------    1 1000     1000            0 May 20 11:47 testfile2
-rw-------    1 1000     1000            0 May 20 11:47 testfile3
-rw-------    1 1000     1000            0 May 20 11:47 testfile4
-rw-------    1 1000     1000       231190 May 20 05:26 ubuntu.jpg
-rw-r--r--    1 1000     1000       199818 May 20 06:05 vsftpd_3.0.2-2_all.deb
226 Directory send OK.
ftp> get ubuntu.jpg
local: ubuntu.jpg remote: ubuntu.jpg
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for ubuntu.jpg (231190 bytes).
226 Transfer complete.
231190 bytes received in 0.01 secs (16026.9 kB/s)
ftp> bye
221 Goodbye.
linux@tuxworld:/tmp$ ls -l ubuntu.jpg 
-rw-rw-r-- 1 linux linux 231190 May 21 07:58 ubuntu.jpg
linux@tuxworld:/tmp$ 

Open the web browser in url type, ftp://ipaddress-of-ftp-server. Give system username and password and now you can download the files.

ftp3

ftp4

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. How to install and configure FTP server with chroot in Ubuntu 12.04 LTS
  2. How to configure FTP server in CentOS 6.3 – vsftpd server
  3. How to install and configure FTP server in Ubuntu 12.04 LTS
  4. Error: Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-9.0-release/Latest/
  5. Password prompt in single user mode is not secure : CentOS/Red Hat
  6. How to configure vsftpd server with virtual user mysql authentication in CentOS 6
  7. How to install and configure samba server in CentOS 6.3
  8. Install and configure rsyslog Centralized logging server in CentOS 6.5
  9. Install and configure nagios core 4 on Ubuntu 12.04 LTS
  10. Install and configure elasticsearch cluster on Ubuntu 14.04 LTS

Filed Under: FTP Server, Linux, Server Tagged With: ftp, vsftp

Reader Interactions

Comments

  1. Neil Niekerk says

    July 20, 2013 at 10:46 pm

    root@Lexington:~# cp -p vsftpd.conf.dpkg-new vsftpd.conf
    cp: cannot stat `vsftpd.conf.dpkg-new’: No such file or directory

    why? I cut & pasted all these lines?

    Reply
    • sharad chhetri says

      July 21, 2013 at 5:01 am

      Hello Neil,

      Thanks for reporting the issue.
      I did a typo in doc.In my case, the vsftpd.conf.dpkg-new file was created in /etc/ after I install new vsftpd package.
      But you can also directly create /etc/vsftpd.conf file.
      Just paste the given below contents and restart the vsftpd service

      listen=YES
      anonymous_enable=NO
      local_enable=YES
      write_enable=YES
      dirmessage_enable=YES
      use_localtime=YES
      xferlog_enable=YES
      connect_from_port_20=YES
      secure_chroot_dir=/var/run/vsftpd/empty
      pam_service_name=vsftpd
      rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
      rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
      
      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

Print double hyphen sign simultaneously in post of Octopress

linux release renew dhcp assigned ip address

How to find when Operating system was installed in linux CentOS and Red Hat

How to install korn shell ksh in Linux

sed: -e expression #1, char 24: Invalid range end

How to page scroll up/down in Linux terminal

send email after mysql backup through bash script in simple way

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ·
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy