Concerning file transfer to and from Max2 I made the observation that (at least on my linux computer using jmtpfs to mount Max2 into my local file system) there was a transfer limit of about 800Mbyte max per file. If I try to transfer a bigger file, I get the (not so informative) response that there is no space left on device (which is obviously not true). A workaround would be to initiate file transfer on the linux side by typing:
split -b 800M /path/to/source_file
and then, on Max2, using Termux or another terminal emulator to change to the directory the files were transfered to and then type:
cat x* > name_of_file_to_be_restituted
--------------
Obviously it would be a good idea to have another, secure, way of transfering big files, too. Above technique is secure (because of usb link cable used) but has the file size limit (at least on my machine), and other ways of doing it like using "Wifi File Manager" for example) have security issues, because other computers on the same net might log into your Max2, too. Also, some wifi file transfer apps seem to dial home quite a lot (I saw a lot of activities on tracking sites when testing them). I haven't tested an app that will set up a wifi network itself.
So here's a proposal for a wifi file transfer that is totally secure. It needs a wifi router so can only be used at home (or some other place where you trust the wifi system.) (I most often want to transfer files while at home and I find it inconvinient to use cable because I have to plug it in, it will always charge battery, which is also not so good if it happens too often).
This proposal is, again, for a linux PC on the other side, but should also work on other operating systems if you find appropriate commands to set up key generation and mounting / unmounting. I can only tell about linux.
---------->
I downloaded "simplesshd" from playstore and installed it on Max2. I changed settings to a different port than 2222 (just for fun, a little obscurity) and told it to start the server when starting the application). This will change its button from a "start" and "stop" behaviour to just displaying "quit" when running.
Max2 will display its IP address which can be used for logging in via ssh or for mounting Max2 on the local file system via sshfs (which I use for file transfer). In order to have a secure login and only allow registered PCs to login simplesshd forces you to set up key exchange as the method except for the very first login (which you only use for transfering keys from PC to Max2, then).
Needed only once on every PC that needs to be registered I type in a terminal shell:
ssh-keygen -t rsa
I will answer all question by just typing "Enter" key (nothing else).
This will, in a directory ~/.ssh, create a file id_rsa.pub which is this PC's key now. I should display this file now and mark its content for later pasting it into a command that I need to type on Max2 shell.
I login in into Max2 by typing (square brackets indicating something that needs to be replaced by actual values, square brackets not to be typed in):
ssh -p [my_chosen_port_number_2222_by_default] [IP_address_displayed_by_Max2]
Because this is the first time I log into Max2, the simplesshd app will display a password. I type this passwort at the PC's ssh shell's prompt and I will be logged into Max2, that is, I have a shell running on my PC, being logged into Max2. I should now, in this shell, be in directory ssh (which I can check by typing "pwd" and which I can change using "cd" command) and I will now type
echo "[pasted_content_marked_above]" > authorized_keys
That is, I will type echo and " and then press the middle mouse button which will include the content marked above and then I will type " again and space and > and then the rest of the command.
(If I want to set up more PCs for secure connection, I can use the PC already set up for logging into Max2 for copying over other PCs id_rsa.pub content -- not described here.)
Having done this I can log out of Max2 by typing "exit" in my shell and I can also destroy file ~/.ssh/id_rsa.pub on my PC and change some access rights. So, on the PC I type in its terminal shell:
cd
chmod 700 .ssh
rm .ssh/id_rsa.pub
Now I should install sshfs on my PC (which my package manager should provide) an I will create a directory for it to mount my Max2 to locally, e.g. by typing
sudo mkdir /mnt/max2
sudo chown [my_login_name] /mnt/max2
and then I will be able to mount my Max2 into my PC's local file system by typing on the PC side (if simplesshd is running on the Max2 side, of course) (one command line, no line breaks):
sshfs -p [port_defaults_to_2222] user@[IP_address_as_displayed_by_simplesshd_app_on_Max2]:/storage/emulated/0 /mnt/max2
I can now access Max2 via its mount point /mnt/max2 which I can, for example, open in pcmanfm or any other file explorer and copy files to or from. I might of course just use the command line for copying, though (see below for an example of syncing using rsync).
Once finished, I can (and must!) unmount Max2 by typing:
fusermount -u /mnt/max2
------------
A convenient way of copying/syncing directories to Max2 would be to use something like:
rsync -rlpgoDvc /from_path[/] /to_path[/]
See rsync's man page for details on when to use trailing slashes and when not. Be aware that it is no good idea to use rsync's -a option (which you would usually to for syncing), because it will include -t (changing sync time on directory) which Max2 does not support.)
So, for example, I could type something like:
rsync -rlpgoDvc /home/my_name/Documents/MagPi-Magazine/ /mnt/max2/
and it would copy all contents of this directory to an equally named directory on Max2. Et voilą!
----------
One last hint: In order to make access more convenient it might be a good idea to set aliasses for mount, unmount and sync command. This might be done by including, e.g. into ~/.bashrc, something like (assuming it's port 2345 and 192.168.2.103 is Max2's ip address it gets on the local network):
alias max2='sshfs -p 2345 user@192.168.2.103:/storage/emulated/0 /mnt/max2'
alias cdmax2='sshfs -p 2345 user@192.168.2.103:/storage/emulated/0 /mnt/max2 && cd /mnt/max2'
alias umax2='cd ; fusermount -u /mnt/max2'
alias max2shell='ssh -p 2345 user@192.168.2.103'
--------
Have fun!
|