Possible to FTP to DietPi and get to /mnt?

Having issues with your DietPi installation or found a bug? Post it here.
User avatar
MichaIng
Site Admin
Posts: 3087
Joined: Sat Nov 18, 2017 6:21 pm

Re: Possible to FTP to DietPi and get to /mnt?

Post by MichaIng »

ProFTPD runs as dietpi:dietpi by default. So while it should be able to write to the root of the external drive, it cannot write to any of its sub directories. The following should do it:

Code: Select all

chown -R dietpi:dietpi /mnt/External
You could use more fine grained permissions but since it seems to be a pure media drive, dietpi group and user are exactly there for this purpose and used by other media-related software services as well.
AJRobson
Posts: 48
Joined: Fri Jan 08, 2021 2:23 pm

Re: Possible to FTP to DietPi and get to /mnt?

Post by AJRobson »

Thanks, I've just tried that. I can now create folders in the subfolders of External but when I try to move a folder from my SD to External I still get a permission denied message
User avatar
MichaIng
Site Admin
Posts: 3087
Joined: Sat Nov 18, 2017 6:21 pm

Re: Possible to FTP to DietPi and get to /mnt?

Post by MichaIng »

What permissions does that particular file have? Probably the dietpi user has no read permissions?

Code: Select all

ls -l /path/to/that/file
AJRobson
Posts: 48
Joined: Fri Jan 08, 2021 2:23 pm

Re: Possible to FTP to DietPi and get to /mnt?

Post by AJRobson »

Thanks those folders are also root:
drwxrwxrwx 34 root root 4096 Mar 15 21:21 Movies
drwxrwxr-x 2 dietpi dietpi 4096 Mar 16 16:43 Preroll
drwxrwxrwx 12 root root 4096 Mar 15 20:54 TV
If I change them to dietpi will Plex still work? I'm assuming so because Preroll is dietpi and that contains videos that play before movies
AJRobson
Posts: 48
Joined: Fri Jan 08, 2021 2:23 pm

Re: Possible to FTP to DietPi and get to /mnt?

Post by AJRobson »

I tried setting those folders to dietpi but still couldn't copy from my SD to External :( I've set them back now
AJRobson
Posts: 48
Joined: Fri Jan 08, 2021 2:23 pm

Re: Possible to FTP to DietPi and get to /mnt?

Post by AJRobson »

I can move files from my PC to the External via filezilla but not from the Pi's SD to the External
AJRobson
Posts: 48
Joined: Fri Jan 08, 2021 2:23 pm

Unable to move files from SD to USB with FTP

Post by AJRobson »

I've got an external hdd plugged into my Pi, using filezilla I can create folders and download content from my External to my PC but if I just want to copy something from my SD card to the External I'm unable to.

The folder I want to copy from on my SD is
/dietpi_userdata/Plex

Code: Select all

root@DietPi:/mnt/dietpi_userdata# ls -la Plex/
total 20
drwxrwxrwx  5 root   root   4096 Mar 16 16:43 .
drwxrwxr-x 11 dietpi dietpi 4096 Mar 16 19:01 ..
drwxrwxrwx 33 dietpi dietpi 4096 Mar 16 18:36 Movies
drwxrwxr-x  2 dietpi dietpi 4096 Mar 16 16:43 Preroll
drwxrwxrwx 12 dietpi dietpi 4096 Mar 15 20:54 TV
The folder I want to copy to on my external drive is
/mnt/External/

Code: Select all

root@DietPi:/mnt/dietpi_userdata# ls -la /mnt/External/
total 8
drwxrwxrwx 1 dietpi dietpi    0 Mar 15 22:20 '$RECYCLE.BIN'
drwxrwxrwx 1 dietpi dietpi 4096 Mar 16 18:19  .
drwxr-xr-x 8 root   root   4096 Mar 15 21:18  ..
drwxr-xr-x 1 dietpi dietpi  184 Mar 16 18:35  Movies
drwx------ 1 dietpi dietpi    0 Mar 15 19:04 'System Volume Information'
drwxr-xr-x 1 dietpi dietpi    0 Mar 16 16:46  TV
d--------- 1 dietpi dietpi    0 Mar 15 22:20  found.000
If I open a terminal and use mv I can copy the file but I'd prefer to have it working with FTP so I can use an app on my phone.

Also Plex can't detect anything on the external so I must have something wrong with the permissions.
User avatar
trendy
Posts: 340
Joined: Tue Feb 25, 2020 2:54 pm

Re: Unable to move files from SD to USB with FTP

Post by trendy »

You need to change the root directory of the ftp server. In proftpd you need to change the line

Code: Select all

DefaultRoot                     /mnt/dietpi_userdata
into something that includes all the subdirectories you want to access.
However copying via ftp is kind of waste of resources, as you move the file over the network twice.
Better use the midnight commander, found in dietpi-software, under software additional.
AJRobson
Posts: 48
Joined: Fri Jan 08, 2021 2:23 pm

Re: Unable to move files from SD to USB with FTP

Post by AJRobson »

In proftpd.conf I already have

Code: Select all

DefaultRoot /mnt/
I'll have a look at midnight commander but it seems like a terminal tool I'd rather stick to FTP if possible so I can do it all through the app on my phone.
User avatar
Joulinar
Posts: 5087
Joined: Sat Nov 16, 2019 12:49 am

Re: Unable to move files from SD to USB with FTP

Post by Joulinar »

not sure why you open this topic while you have already open another one. Will move them together.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply