Page 1 of 1

Proftpd + second external hard drive

Posted: Fri Jun 09, 2017 2:51 pm
by Newtorpi3
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?

Re: Proftpd + second external hard drive

Posted: Fri Jun 09, 2017 5:08 pm
by SurferTim
I use a symlink to a directory I can access.

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

Re: Proftpd + second external hard drive

Posted: Fri Jun 09, 2017 5:53 pm
by Newtorpi3
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

Re: Proftpd + second external hard drive

Posted: Fri Jun 09, 2017 6:38 pm
by Newtorpi3
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

Re: Proftpd + second external hard drive

Posted: Fri Jun 09, 2017 7:08 pm
by SurferTim
How many users access this second drive?

Re: Proftpd + second external hard drive

Posted: Fri Jun 09, 2017 7:10 pm
by Newtorpi3
SurferTim wrote:How many users access this second drive?
Only me

Re: Proftpd + second external hard drive

Posted: Fri Jun 09, 2017 7:51 pm
by SurferTim
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

Re: Proftpd + second external hard drive

Posted: Fri Jun 09, 2017 8:23 pm
by Newtorpi3
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

Re: Proftpd + second external hard drive

Posted: Fri Jun 09, 2017 8:26 pm
by SurferTim
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.

Re: Proftpd + second external hard drive

Posted: Fri Jun 09, 2017 9:13 pm
by Newtorpi3
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

Re: Proftpd + second external hard drive

Posted: Fri Jun 09, 2017 9:52 pm
by SurferTim
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.

Re: Proftpd + second external hard drive

Posted: Fri Jun 09, 2017 10:56 pm
by Newtorpi3
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

Re: Proftpd + second external hard drive

Posted: Fri Jun 09, 2017 11:01 pm
by SurferTim
Now for the first part of your question. How do you plan on accessing that drive with FTP?

Re: Proftpd + second external hard drive

Posted: Sat Jun 10, 2017 1:22 am
by Newtorpi3
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.

Re: Proftpd + second external hard drive

Posted: Sat Jun 10, 2017 12:08 pm
by SurferTim
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?

Re: Proftpd + second external hard drive

Posted: Sat Jun 10, 2017 1:20 pm
by SurferTim
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.

Re: Proftpd + second external hard drive

Posted: Sat Jun 10, 2017 2:31 pm
by Newtorpi3
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.

Re: Proftpd + second external hard drive

Posted: Sat Jun 10, 2017 2:32 pm
by SurferTim
SFTP is a much better (safer) protocol.