Newtorpi3
Posts: 12
Joined: Fri Jun 09, 2017 2:06 pm

Proftpd + second external hard drive

Fri Jun 09, 2017 2:51 pm

How do I setup proftpd so I can ftp to my second hard drive?

I'm running dietpi with a microsd and one external hard drive already. The user data is on the external hard drive.

I have the second external drive mounted and I can grab the udid.

I'm guessing I have to change the path of proftpd? It looks like proftpd root path when I log in is the first drive which is mounted under /dev/sda1 /mnt/34169A6B169A2E3C

While the second is mounted under
/dev/sdb1 /mnt/ACACC08FACC0560C

Would I change the path to /dev? If so, how do I do so?

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Proftpd + second external hard drive

Fri Jun 09, 2017 5:08 pm

I use a symlink to a directory I can access.

Edit: or mount in /etc/fstab using uuid mounted to your preferred location.

Newtorpi3
Posts: 12
Joined: Fri Jun 09, 2017 2:06 pm

Re: Proftpd + second external hard drive

Fri Jun 09, 2017 5:53 pm

Would this guide help me to creating a symlink?
http://www.proftpd.org/docs/howto/Chroot.html

I have 0 understanding of all this and am reading the guide over and over to figure it out. The basic idea of symlink is I have to somehow create a symlink in my chroot folder to my second hard drive which is already mounted as
/dev/sdb1 /mnt/ACACC08FACC0560C

Is this correct? If so, I'll be trying to figure out how to do so

Newtorpi3
Posts: 12
Joined: Fri Jun 09, 2017 2:06 pm

Re: Proftpd + second external hard drive

Fri Jun 09, 2017 6:38 pm

Since I can't symlink to the root of the first hard drive, I created a folder called drive2. This way I can symlink my second drive to this folder?

ln -s /mnt/ACACC08FACC0560C /mnt/34169A6B169A2E3C/dietpi_userdata/drive2

is this correct?

I'm not sure where I would input this command

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Proftpd + second external hard drive

Fri Jun 09, 2017 7:08 pm

How many users access this second drive?

Newtorpi3
Posts: 12
Joined: Fri Jun 09, 2017 2:06 pm

Re: Proftpd + second external hard drive

Fri Jun 09, 2017 7:10 pm

SurferTim wrote:How many users access this second drive?
Only me

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Proftpd + second external hard drive

Fri Jun 09, 2017 7:51 pm

If it is just you, then you can mount the drive directly into a folder in your home directory. If you are using pi as your user, then:

Code: Select all

$ mkdir extdrive
$ sudo leafpad /etc/fstab
then add this, changing the UUID to your drive. My external drive is formatted with ntfs, so if yours isn't change that from ntfs-3g to your format.

Code: Select all

UUID=1D1798506089E3C4  /home/pi/extdrive ntfs-3g auto,nofail,rw,default 0 0

Newtorpi3
Posts: 12
Joined: Fri Jun 09, 2017 2:06 pm

Re: Proftpd + second external hard drive

Fri Jun 09, 2017 8:23 pm

SurferTim wrote:If it is just you, then you can mount the drive directly into a folder in your home directory. If you are using pi as your user, then:

Code: Select all

$ mkdir extdrive
$ sudo leafpad /etc/fstab
then add this, changing the UUID to your drive. My external drive is formatted with ntfs, so if yours isn't change that from ntfs-3g to your format.

Code: Select all

UUID=1D1798506089E3C4  /home/pi/extdrive ntfs-3g auto,nofail,rw,default 0 0
Do I have to restart the pi for the changes to take place? Or do I have to unmount and then remount? It isn't showing up under drive2

I did it a little bit differently and it I'm not quite sure if it's working. I stopped and restarted the proftpd service.

I ftped into my root dir and created a folder called drive2.
I then used sudo nano /etc/fstab to edit

UUID=ACACC08FACC0560C /dietpi_userdata/drive2 auto auto,nofail,rw,default 0 0

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Proftpd + second external hard drive

Fri Jun 09, 2017 8:26 pm

You need to restart the pi to get it to mount. The "nofail" parameter will keep the RPi from locking up when booting with the drive disconnected. Sometimes I boot my RPi without the external drive.

Newtorpi3
Posts: 12
Joined: Fri Jun 09, 2017 2:06 pm

Re: Proftpd + second external hard drive

Fri Jun 09, 2017 9:13 pm

SurferTim wrote:You need to restart the pi to get it to mount. The "nofail" parameter will keep the RPi from locking up when booting with the drive disconnected. Sometimes I boot my RPi without the external drive.
It doesn't up under the drive2 folder

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Proftpd + second external hard drive

Fri Jun 09, 2017 9:52 pm

Is /dietpi_userdata/ a folder in the root directory? edit: Why are you mounting it there? If you want to access that drive with FTP, it must be mounted in a folder that you can login to, like /home/pi/dietpi_userdata.

Newtorpi3
Posts: 12
Joined: Fri Jun 09, 2017 2:06 pm

Re: Proftpd + second external hard drive

Fri Jun 09, 2017 10:56 pm

I figured it out, I forgot umount and mount the drive.

dietpi_userdata is the root folder. I was able to get it working under dietpi_userdata/drive2

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Proftpd + second external hard drive

Fri Jun 09, 2017 11:01 pm

Now for the first part of your question. How do you plan on accessing that drive with FTP?

Newtorpi3
Posts: 12
Joined: Fri Jun 09, 2017 2:06 pm

Re: Proftpd + second external hard drive

Sat Jun 10, 2017 1:22 am

I'm able to ftp to dietpi_userdata and the second drive shows in the folder drive2.

I mounted the drive in the dietpi_userdata/drive2 so this is why it's working now?

This is my first time using linux so I'm not quite sure.

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Proftpd + second external hard drive

Sat Jun 10, 2017 12:08 pm

I don't know what you mean by your last post. How do you FTP into that folder? Does it require a user/password? Or is it a public directory? Did you set up a <Directory "/path/to/My Directory"> in the config file?

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Proftpd + second external hard drive

Sat Jun 10, 2017 1:20 pm

Since you are new at this, I will give you a warning.

FTP is inherently insecure. Your user/password is sent clear text, so it matters not how complex your password is, it can be intercepted.

If you are using proFTP and have not edited /etc/proftpd/proftpd.conf to limit users to their own home directory, you now have a severe security risk. Anyone logging in can wander through your entire OS files. They can't change anything outside the home directory they logged into, but being able to read your setup files can be disastrous.

To limit users to their home directory, open /etc/proftpd/proftpd.conf as root (sudo) with a text editor.
Find the line "#DefaultRoot".
Under it, add this:

Code: Select all

DefaultRoot ~
That is a tilde.

Newtorpi3
Posts: 12
Joined: Fri Jun 09, 2017 2:06 pm

Re: Proftpd + second external hard drive

Sat Jun 10, 2017 2:31 pm

SurferTim wrote:I don't know what you mean by your last post. How do you FTP into that folder? Does it require a user/password? Or is it a public directory? Did you set up a <Directory "/path/to/My Directory"> in the config file?

It requires a password. I'll check the config again and change everything to sftp.

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Proftpd + second external hard drive

Sat Jun 10, 2017 2:32 pm

SFTP is a much better (safer) protocol.

Return to “Beginners”