+6 votes
1.9k views
asked in Linux by (11.6k points)

How to Create an FTP Server on a Virtual Machine Ubuntu 12.04

1 Answer

+8 votes
answered by (140k points)

Install Ubuntu 12.04 Virtual Machine

I'm assuming you're familiar with creating Virtual Machines, so these steps are a bit vague, noting some caveats.

Server 1 Download Ubuntu 12.04 ISO and create a new Virtual Machine with it.

2 Follow the steps in the initial setup wizard Ubuntu. When you are prompted to specify how to partition the boot volume, be sure to specify "guided LVM."

3 Log in with the username you created in the setup wizard and type "sudo su root" to change root. Change to the root user is optional, but if you choose not to, you have to type "sudo" before all your commands.

4 Switch to a static IP address:

root: / # nano / etc / network / interfaces

This takes you to the configuration interface, you'll have to change to reflect the IP scheme. For example:

auto eth0

iface eth0 inet static

address 10.0.0.3

netmask 255.255.255.0

10.0.0.1 gateway

Outside the nano, press Ctrl + O to write the changes. Then press [ENTER] to save it with the same filename. Finally press Ctrl + X to exit nano.

Add a second hard drive

It's good to put the data on a second hard disk. That way you can upgrade your operating system, and troubleshoot without having to worry too much about losing your data.

1 Edit the configuration of the virtual machine and add a hard drive.

2 List the disks on the computer today and see the second hard drive

root: / # fdisk l

Pantalla de Información de disco

3 Partition the second drive

root: / # fdisk / dev / sdb

Type the following in fdisk menu:

n (to create a new disk)

p (to be a master disk)

1 (for the disk name / sdb1)

Unless the default values ​​for the first sector and last sector by pressing [ENTER].

w (write changes)

  4 Updating the kernel with changes

root: / # partrobe / dev / sdb

5 Format the new partition

root: / # mkfs / dev / sdb1-t ext4

Mount the home directory of the new partition

After creating a user FTP store your data on the second hard disk. So you play a kind of shell game to mount / home to the new partition without losing the data that exists in the directory / home.

1 Mounting the New Partition

root: / # mkdir / mnt / home1

root: / # mount-t ext4 / dev / sdb1 / mnt / home1

2 Copy data from your old home to the new home1

root: / # cd / home

root: / # find. -depth -print0 | cpio --null --sparse -pvd / mnt / home1

3 Check that all this copying

root: / # cd /

root: / # cd / mnt / home1

root: / # ls

'ls' will list all the files that are copied.

4 Remove / mnt / home1

root: / # umount / mnt / home1

5 Rename the old directory home

root: / # mv / home / home_old

6 Create a new directory

root: / # mkdir / home

7 Install the new home directory of the second hard drive

root: / # mount / dev / sdb1 / home

8 Make this change permanent and remain mounted even after a reboot, altering the fstab file

root: / # nano / etc / fstab

Add this line to the file:

/ dev / sdb1 / home ext4 nodev, nosuid 0 2

Type Ctrl + O, [ENTER], Ctrl + X

Review 9 then recheck after a reboot

root: / # cd / home

root: / # ls

10 can now delete the old directory home

root: / # rm r / home_old

Configuring FTP

1 Install VSFTPD

root: / # apt-get install vsftpd

2 Change the configuration file for vsftpd

root: / # nano /etc/vsftpd.conf

Make at least the following changes, however read the man pages to see if there are other settings you would like to change, such as adding IP addresses and ports or other passive security enhancements:

a. Remove # from before local_enable = YES to uncomment it.

b. Remove # from before write_enable = YES to uncomment it.

c. Change from "NO" to "YES" by chroot_local_user (ex: chroot_local_user = YES).

d. Type Ctrl + 0, [ENTER], Ctrl + X.

3 Restart the vsftpd service

root: / # service vsftpd restart

4 Create a local user who can authenticate people trying to connect to FTP Server

root: / # useradd ftp

root: / # passwd ftp

Enter the password

5 Create a directory for the FTP user

root: / # cd / home

root: / # mkdir ftp

root: / # chmod a-w ftp

At this point, you should have a working FTP server. You can connect with a client like FileZilla or can connect via the command line with "ftp ip.add.re.ss." If you are configuring this command for users outside the network, you may need to check firewall configuration to ensure that the appropriate ports are open, and may require more work in the vsftpd.conf file depending on whether you are using FTP passive or active.

Ready !!!

Ask a Question
Welcome to WikiTechSolutions where you can ask questions and receive answers from other members of the community.

You can ask a question without registration.

Categories

...