Github sponsorship


Fork me on GitHub

I. Linux tips

1. Mounting a File System of a remote computer

It can always be useful to be able to mount a File System from another computer. In here, we'll use sshfs to do it (other softwares like ftpfs exist).

Preparing the field

First, you need to be able to connect on the remote computer with the ssh command:

> ssh user@some_computer
# if it doesn't work, try with the configured ssh port like this (let's say it's 2564):
> ssh user@some_computer -p 2564

If everything worked fine, we can move forward.

Mounting the File System

In general, it's preferable to mount the remote directory inside the /tmp directory. So first:

mkdir /tmp/remote

Ok, now we just have to mount it:

sshfs user@some_computer:/the/remote/folder /tmp/remote/

And that's all! However, it's possible you might encounter rights issue. For this, we'll need to add more options. First, you'll need to get your remote folder user id and group id:

> ssh user@some_computer
> ls -l /the/remote/folder
drwxr-xr-x  3 imperio imperioland 4096 Dec 23 11:33 /the/remote/folder
> ls -ln /the/remote/folder
drwxr-xr-x  3 1000 1000 4096 Dec 23 11:33 /the/remote/folder

Create two files on your computer (not the remote one!) like this:

echo imperio:1000 > uidmap
echo imperioland:1000 > gidmap

Don't forget to enter your information and not mine! Then, we can retry to use sshfs:

sshfs -o allow_other,idmap=file,uidfile=`pwd`/uidmap,gidfile=`pwd`/gidmap,nomap=ignore user@some_computer:/the/remote/folder /tmp/remote

Here you go!