jeztastic
Posts: 5
Joined: Mon May 30, 2016 11:01 am

Problem with SFTP into external USB HDD

Sat Sep 24, 2016 6:29 pm

Hi,

I have mounted a HDD, but when I try and transfer files via SFTP from Filezilla on my Windows desktop I get this error message in Filezilla:

Code: Select all

mkdir /mnt/readyshare/Pictures: permission denied
Obviously a permissions problem, but I have tried changing the permissions using

Code: Select all

chmod -R 755 /mnt/readyshare
and no joy.

This is my fstab:

Code: Select all

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
   UUID=1ffe8cff-0a5b-4e4f-b026-f39e2630b70e /mnt/readyshare ext4 defaults 0 0
I don't know if this is related, but all of a sudden I can't ssh in using Connectbot from android over wireless, but I still can via Windows 10 and PuTTy.

Any help much appreciated.

Jez

User avatar
DougieLawson
Posts: 37794
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Problem with SFTP into external USB HDD

Sat Sep 24, 2016 6:46 pm

If the USB HDD has a FAT or NTFS filesystem then the owner / group is root unless you override it on the mount command.

If you're ONLY going to use the drive with your RPi then reformat it with an ext4 filesystem and the security problems will just evaporate into a historical nightmare. Ext4 filesystems have a sane security model. Windows FAT or NTFS filesystems don't have that.

SFTP uses the security credentials you use when you logon to the SFTP server.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

ssfdre38
Posts: 35
Joined: Fri Jul 08, 2016 7:21 am

Re: Problem with SFTP into external USB HDD

Sat Sep 24, 2016 6:48 pm

well first make sure that the external drive is mounted and second if you are not on the same network as your pi, you wont be able to connect to it unless you open up the ports in your modem to your pi so you can connect to it externally
Rasbian Latest Builds on SourceForge at https://sourceforge.net/projects/raspbian/
Github at https://github.com/ssfdre38

3 2B & 1 3B

User avatar
thagrol
Posts: 2436
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Problem with SFTP into external USB HDD

Sat Sep 24, 2016 6:59 pm

Couple of suggestions:

Try

Code: Select all

sudo chmod -R 0755 /mnt/readyshare
the "755" needs to be in octal (base 8) so needs a leading 0. However this may not help as it only gives write permission to the file/directory owner. For the mount point (top directory of the disc) this will be root.

If you login to the pi via ssh with the same username and password you are using from windows are you able to write to the same file/directory?

The insecure way to allow users to write to the share is

Code: Select all

sudo chmod -R 0777 /mnt/readyshare
which gives write permission to everybody. If you want something more secure you'll need to look into ownership and groups as well as permissions.
Attempts to contact me outside of these forums will be ignored unless signed in triplicate, sent in, sent back, queried, lost, found, subjected to public enquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters

User avatar
thagrol
Posts: 2436
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Problem with SFTP into external USB HDD

Sat Sep 24, 2016 7:05 pm

DougieLawson wrote:If the USB HDD has a FAT or NTFS filesystem then the owner / group is root unless you override it on the mount command.

If you're ONLY going to use the drive with your RPi then reformat it with an ext4 filesystem and the security problems will just evaporate into a historical nightmare. Ext4 filesystems have a sane security model. Windows FAT or NTFS filesystems don't have that.

SFTP uses the security credentials you use when you logon to the SFTP server.
From the fstab entry it looks like it is ext4. Which suggests that whichever user being used in filezilla doesn't have write permission on the hdd. Hence my suggestions above.

I'm afraid the security problems won't "evaporate into a historical nightmare" you'll just be dealing with a different set of them.

(edited to fix spelling error)
Attempts to contact me outside of these forums will be ignored unless signed in triplicate, sent in, sent back, queried, lost, found, subjected to public enquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters

jeztastic
Posts: 5
Joined: Mon May 30, 2016 11:01 am

Re: Problem with SFTP into external USB HDD

Sat Sep 24, 2016 9:05 pm

thagrol wrote:Couple of suggestions:

If you login to the pi via ssh with the same username and password you are using from windows are you able to write to the same file/directory?

The insecure way to allow users to write to the share is

Code: Select all

sudo chmod -R 0777 /mnt/readyshare
which gives write permission to everybody. If you want something more secure you'll need to look into ownership and groups as well as permissions.
This fixed the sftp issue, thanks. It doesnt have to be very secure, it's file backup and a server for music to my squeezeboxes.

I still can't ssh in via wifi, i am using user pi and the same password for everything. I have a new router and it shows the network in two parts - 'wifi' and 'wired network'. Does this mean there are actually two networks that aren't speaking to each other? I also have a homeplug with a wifi extender. Seems unlikely though, it worked fine until the sftp proplem emerged...

To be clear, sftp would connect me but not allow me to write to that drive. Using ssh with PuTTy from the same homeplug ethernet connected windows machine would allow me to connect to the pi, but ssh from connectbot via wifi does not.

:Edit: Ok, connectbot started working. I think my new router may be to blame somehow. It came with my vodafone broadband package. The dsl connection is still intermittent as well.

jeztastic
Posts: 5
Joined: Mon May 30, 2016 11:01 am

Re: Problem with SFTP into external USB HDD

Mon Sep 26, 2016 6:09 pm

Raspberry Pi is working fine now, but I am still sometimes unable to connect from my Android tablet. I really don't know why. At present I cannot contact it via ssh, and i cannot access the squeezebox server on port 9000 either. It worked briefly yesterday but then stopped again.

If you cannot advise me here perhaps you cold point me in the right direction. Hard to know where to go as I'm not sure what is causing the problem.

Just tried using my partners android phone and it connects fine.

Thanks.

User avatar
thagrol
Posts: 2436
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Problem with SFTP into external USB HDD

Tue Sep 27, 2016 4:10 pm

jeztastic wrote:Just tried using my partners android phone and it connects fine.
That suggest the problem is with your android devie(s). Compare setting on both devices to see what's different, including networking and carrier.
Attempts to contact me outside of these forums will be ignored unless signed in triplicate, sent in, sent back, queried, lost, found, subjected to public enquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters

Return to “Raspbian”