File Server With Samba and FTP in FreeBSD


This manual describes how to create file server, where users from can access their files with samba client and FTP server, (from windows too). In this example there are two users, testa and testu. User testa can read and write in admin (FTP only) and public directories. User testu can read and write in the public directory and can read admin directory.

In this example were used:

  • FreeBSD 7.2
  • VsFTP
  • Samba Server

Let’s Start

  1. Create Users and Directories

    1. Create Users and answer all questions

      Type in terminal

      adduser testa
      adduser testu

      File /etc /passwd should be like this


      Create groups named ‘all’ and ‘admin’ and edit /etc/group file like this

    2. Create Directories
      mkdir /files
      mkdir /files/admin //Administrative access ex. for user testa
      mkdir /files/public //Public access ex. for user testu


    3. Set permissions like this
      files# ls -all /
      dr-xr-xr-x 4 admin admin 512 Sep 18 13:11 files
      files# ls -all /files/
      drwxrwxr-x 3 admin admin 512 Oct 6 12:29 admin
      drwxrwxr-x 5 all all 512 Oct 6 12:43 public


  2. Install vsftp FTP Server

    1. Edit Config File
      mcedit /usr/local/etc/vsftpd.conf
    2. Edit and add in vsftpd.conf
    3. Restart FTP Server
      /usr/local/etc/rc.d/vsftpd restart
  3. Install Samba Server

    1. Edit Config File
      mcedit /usr/local/etc/smb.conf
    2. Add
      hosts allow = 192.168.0. 127.

         comment = Admin Files
         path = /files/admin
         public = yes
         writeable = no
         read only = yes
         comment = Public Files
         path = /files/public
         directory mask = 0775
         create mask = 0664
         force group = all
         force user = all
         public = yes
         writeable = yes
         read only = no
    3. Restart Samba Server
      /usr/local/etc/rc.d/samba restart

If you need to add users who have administrator’s access (for access /files/*) you need to add username into /etc/group after all:*:1002:testa, another_user. In this example user testa can create delete and read in /files/*, user testu only in /files/public/*


3 Responses

  1. Heather

    November 7, 2013 11:12 pm

    Exactly how long did it take u to create “File Server With Samba and
    FTP in FreeBSD |”? It possesses quite a
    bit of good info. Appreciate it ,Bryant


Leave a Reply