Results 1 to 2 of 2

Thread: Ubuntu 12.04 LTS Samba + Pure-FTPD Setup question

  1. #1
    Join Date
    Dec 2012
    Beans
    7

    Ubuntu 12.04 LTS Samba + Pure-FTPD Setup question

    Hello!

    I'm looking for some assistance in setting up pure-ftpd to be able to upload documents\pictures via FTP to a Samba share I have setup so I can access them on a Windows 7 desktop. Although I could use ftp:serverip via a web browser and upload\download items from there, I have a specific reason why it needs to be a network share I can access via My Computer inside of the Windows desktop. Unfortunately, configuring Samba is one of the more "extreme" things I have done recently and have no idea how to setup an FTP server using Linux.

    Here's a basic rundown of what I'm trying to accomplish:

    user1 needs to upload a photo via ftp to the samba share located at /media/data/photos located on /dev/sdb1, then from inside of their Windows desktop application, upload the photo into said application.


    I have tested the ability to read\write\delete items from this samba share, so that isn't the problem. I'm just unfamiliar with FTP servers.

  2. #2
    Join Date
    Dec 2012
    Beans
    7

    Lightbulb Ubuntu 12.04 LTS Samba + Pure-FTPD Setup Guide for those new to Linux

    Well, I have been able to figure this out with some quite extensive searching.


    New Hard Disk Setup

    I'll first start off with creating a second hard drive to use as the "shared" drive:

    Code:
     
    fdisk /dev/sdb
    - option n
    - option p
    - option 1
    - select defaults for the next 2 prompts
    - option w
    Next we will format the new partition with a file system. In this case, I used the ext4 file system on the new drive labeled sdb1 located in /dev
    Code:
    mkfs.ext4 /dev/sdb1
    Create a mount point for the sdb1 partition
    Code:
    mkdir /media/data
    Now we will edit fstab to auto mount /dev/sdb1 upon boot. I used the nano text editor for this part. You can use which ever text editor you are comfortable with.
    Code:
    nano /etc/fstab
    Add the following line to the bottom of the fstab config file
    Code:
    /dev/sdb1    /media/data    ext4    defaults    0    0
    Save the fstab config and reboot the server
    Code:
    reboot

    Samba Setup


    Start off by creating a directory to share using Samba.
    Code:
    mkdir -p /media/data/share
    Now to install Samba!
    Code:
    apt-get install samba
    Make a backup for the Samba configuration file just in case something happens.
    Code:
    cp /etc/samba/smb.conf /etc/samba/smb.conf.orig
    Remove the default smb.conf file
    Code:
    rm /etc/samba/smb.conf
    Create a new blank smb.conf file
    Code:
    touch /etc/samba/smb.conf
    Edit the blank smb.conf file
    Code:
    nano /etc/samba/smb.conf
    I have used the following config for the test environment and unfortunately I do not know all of the options that can be used inside of the smb.conf file
    Code:
    [global]
        workgroup = workgroup
    
        server string = Ubuntu File Server
    
        netbios name = $servername
    
        security = user
        map to guest = bad user
    
        dns proxy = no
    
    [Photos]
        path = /media/data/share
    
        valid users = @$groupname
    
        browsable = yes
        writable = yes
        guest ok = no
        read only = no
        create mask = 0644
        directory mask = 0755
    Once you have saved the new smb.conf file, reboot the services smbd & nmbd
    Code:
    restart smbd
    
    restart nmbd
    Create a new group for the Samba share
    Code:
    addgroup $groupname
    Change group access to the share
    Code:
    chgrp -R $groupname /media/data/share
    Change permissions to the root of the share
    Code:
    chmod 777 /media/data/share
    Add a user account of the share group
    Code:
    adduser $username $groupname
    Finally, create a share password for the user account
    Code:
    smbpasswd -a $username
    You now will be able to access the network share from Windows.


    Pure-FTPD Setup

    Install pure-ftpd
    Code:
    apt-get install pure-ftpd
    Add a virtual user to the ftp server and point it to the directory you want the virtual user to have access to when uploading files to the Samba share
    Code:
    pure-pw useradd $username -u $username -g $groupname -d /path/to/samba/share
    Make the pure-ftpd database
    Code:
    pure-pw mkdb
    Run this command (still trying to figure out what that does)
    Code:
    ln -s /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/50pure
    Restart the pure-ftpd service
    Code:
    service pure-ftpd restart

    Now you have an FTP server that can drop files to a Samba share that can be accessed by those who use Windows desktops.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •