How do we share files between a wide array of opearting systems? we find the lowest common denominator
Moving Files Between Machines
No more flash drives, only network
It seems so simple, but it really did take me quite some time stop moving files with a flash drive. The flash drive approach is perfectly fine until you begin to diversify your operating systems.
Currently I have FreeBSD running on my laptop, Gentoo on my desktop, Plan9 on my raspi, Haiku somewhere in there, multiple CentOS and Ubuntu and FreeBSD VMs on Digital Ocean, and OpenBSD but only in the winter because the Pentium4 gets very warm. Little to say filesystem incompatibility has become a relevant issue to me.
Yes, FreeBSD does have some RO support for ext2 and (maybe) ext3 but RW is a hard requirement for me. Below I have included a table of filesystem support.
System1 | System2 | Lowest Common Denominators |
---|---|---|
Linux | Windows | ntfs, fat |
Linux | Linux | ext4 |
MacOS | anything else | fat |
FreeBSD | anything else | fat |
OpenBSD | anything else | fat |
Haiku | anything else | fat, befs if you still own a bebox |
Plan9 | anything else | fat, fossil if you care that much |
Obviously we should all just use fat, right? no. Please no. The problem now arises – fat sucks and no one should be forced to use it. How do we solve the problem? look to the network. Many people will set up an nfs/samba server on their network, completely eliminating the need for fat formatted usb flash drives . . . but I am lazy and don’t run a windows machine so ssh is perfectly fine. Ssh is probably the most useful tool in existence and I encourage everyone to learn how to use it.
Many people claim that ssh is /too slow/ or /too cumbersome/ for filesharing. Don’t listen to them. They obviously don’t know what they’re talking about. On my network, every system that is capable of running sshd is running sshd. Every machine has every other machines keys.
Examples
read the man pages if you have any question. Recursive copying can be destructive to please be careful
# copying a file from a remote machine % scp user@remote-machine:/path/to/remote/file /path/to/destination # copying a directory recursively to a remote machine % scp -r /path/to/local/dir user@remote-machine:/path/to/destination # mounting remote directory over ssh, requires fuse % pkg instll fusefs-sshfs % kldload fuse # alternatively run 'sysrc kld_list+=fuse' if you want fuse.ko loaded at boot % sshfs user@remote-machine:/path/to/remote/dir /path/to/local/destination # using sftp, where -r enables recursion % sftp -r user@remote-machine # change dir on local machine sftp> lcd /path/to/local/dir # change dir on remote machine sftp> cd /path/to/local/dir # download file from remote machine sftp> get /path/to/file # upload file to remote machine sftp> put /path/to/file