Setting+up+an+FTP+server+on+a+Mac

There are 2 ways to go about setting up an FTP server on a mac. You may want to try option A first and move on to option B if you are unhappy with the outcome from A.


 * A.** Use your mac's sharing utility. This is straight forward and described ** here **.
 * B.** Do it yourself. This is a little more involved, but gives you more control over the process. The general steps are described **here** . I will go into a little more detail below.

code format="bash" sudo port -v selfupdate code code format="bash" sudo port install vsftpd code code format="bash" sudo cp /opt/local/etc/vsftpd.conf.sample /opt/local/etc/vsftpd.conf code code format="bash" sudo nano /opt/local/etc/vsftpd.conf code anonymous_enable=NO
 * 1. Install ** Mac Ports.
 * 2.** Choose a location for your ftp directory, create a user with this directory designated as their home directory. ** This site ** describes how to create a new account on a mac. Right click on the user you have created in the list of users. Choose advanced options and enter the directory you have chosen as the location for your ftp server as the home directory of this user.
 * 3.** Open the terminal application. You need to have sudo privileges for many of the following steps. If your root user is not enabled follow** [|these instructions] **.
 * 4.** Update your Ports.
 * 5.** Install the vsftpd using Mac Ports.
 * 6.** Create a vsftpd.config file which defines the rules to secure your ftp server. When you install vsftpd using Mac Ports, a sample config file is created in /opt/local/etc/. Use the following command to create a config file from the sample file.
 * 7.** Open the vsftpd.config file on any editor and make the following changes. The command below uses the nano text editor.

local_enable=YES

write_enable=YES

listen=YES

chroot_local_user=YES

local_umask=022

Optional: ftpd_banner=Welcome to my FTP service! userlist_enable=YES* userlist_file=/opt/local/etc/vsftpd.user_list*


 * If you do not enable the userlist your ftp site will be accessible using the username and password of any account on your machine. If you would like to prevent this add all account names except the one you have designated for ftp access to the vsftpd.user_list file.

code format="bash" sudo /opt/local/sbin/vsftpd code code format="bash" ftp your ip address code
 * 8.** Try running your server by issuing the following command:
 * 9.** In a NEW terminal window try connecting to your server.
 * 10.** If you want vsftpd to load automatically at start up/restart. You can add a cronjob to run the vsftpd at reboot by adding:

@reboot /opt/local/sbin/vsftpd

To edit/create crontab, use the following command. code format="bash" crontab -e code