PINE64
USB file transfer question - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PinePhone (https://forum.pine64.org/forumdisplay.php?fid=120)
+--- Forum: PinePhone Software (https://forum.pine64.org/forumdisplay.php?fid=121)
+---- Forum: Debian on PinePhone (https://forum.pine64.org/forumdisplay.php?fid=139)
+---- Thread: USB file transfer question (/showthread.php?tid=12469)



USB file transfer question - DarkManiels - 12-11-2020

Thanks to the 5.9 kernel I'm once again able to see my phone (UBPorts CE with the upgraded main board) when I plug it into a computer, which is great. But when I try to transfer files from the computer to the phone I can't open them on the phone (I get various errors, depending on the file type).

At first I thought the files were being corrupted somehow by the transfer, but I just realized that's not the problem. The files are being transferred over with root ownership and permissions, instead of mobian. I know I can go in afterwards with chown to change the ownership to mobian, and then the files can be opened on the phone, but it would be nicer if they could just transfer over with mobian ownership from the start.

Does anyone know how I can transfer files to the phone with mobian ownership already set up?

Thanks!


RE: USB file transfer question - kop316 - 12-11-2020

How are you trying to transfer them? I have beeen successful with SSH and USB-MTP


RE: USB file transfer question - cybercow - 12-11-2020

A possible solution would be to set your username on mobian to the same as on your computer.
I haven't tried that so I do not know what you would have to do so that phosh is ok with it.
A workaround would be to make a "mobian" user on your workstation and change the owner on your workstation.

The most clean way would possibly be to let the Bluetooth or USB file sharing daemon do that.
Unluckily I am not involved enough to know how to do that.

Sorry if that isn't helpful.

Another workaround would be to set the permission of "others" to what you need it to be.

(12-11-2020, 12:25 PM)kop316 Wrote: How are you trying to transfer them? I have beeen successful with SSH and USB-MTP
The thing with ssh is that there the ssh server takes care of the problem.
With USB-MTP I think you mean using a usb stick which most likely is formated NTFS or fat.
This would mean that the "owner" and the permission are getting lost since this are features of the filesystem, which NTFS and fat does not support and
aren't part of the file itself.


RE: USB file transfer question - DarkManiels - 12-11-2020

(12-11-2020, 12:25 PM)kop316 Wrote: How are you trying to transfer them? I have beeen successful with SSH and USB-MTP

SSH works fine, since as @cybercow suggested the SSH server takes care of it. What I'm having a problem with is direct USB connection from my computer (running PopOS 20.10) to the phone. Not sure if it's technically using MTP or some other protocol.

(12-11-2020, 12:53 PM)cybercow Wrote: A possible solution would be to set your username on mobian to the same as on your computer.
I haven't tried that so I do not know what you would have to do so that phosh is ok with it.
A workaround would be to make a "mobian" user on your workstation and change the owner on your workstation.

The most clean way would possibly be to let the Bluetooth or USB file sharing daemon do that.
Unluckily I am not involved enough to know how to do that.

Sorry if that isn't helpful.

Another workaround would be to set the permission of "others" to what you need it to be.

(12-11-2020, 12:25 PM)kop316 Wrote: How are you trying to transfer them? I have beeen successful with SSH and USB-MTP
The thing with ssh is that there the ssh server takes care of the problem.
With USB-MTP I think you mean using a usb stick which most likely is formated NTFS or fat.
This would mean that the "owner" and the permission are getting lost since this are features of the filesystem, which NTFS and fat does not support and
aren't part of the file itself.

Thanks for the tips @cybercow . It would be nice if the USB file sharing daemon just handled this for me, but it doesn't, and I don't even know where I'd look to change its "settings," if that's possible.

Ultimately it's no real biggie, though. I just realized I can use chown recursively, so if I copy a bunch of files I can just quickly set the ownership of the whole folder and all the files to mobian, then go my merry way without too much trouble.


RE: USB file transfer question - Zebulon Walton - 12-11-2020

I ran into this problem and found that when copying files directly to the phone over USB they are owned by root with permissions set such that only root can access them.

To fix this you can ssh into the phone (or use the built-in terminal) and issue the command "sudo chown mobian:mobian filename_pattern" to fix the ownership. With ssh running though I find it easier to just use sshfs and the files then arrive on the phone with the proper ownership. (It is slower than a direct USB transfer though.)