adds sshfs

This commit is contained in:
waldek 2021-07-13 15:33:04 +02:00
parent 6a07b2e632
commit 06c37f84b9
1 changed files with 46 additions and 4 deletions

View File

@ -319,6 +319,52 @@ Last login: Tue Jul 13 14:12:18 2021 from 172.30.40.99
➜ ~
```
## SFTP
We've done quite a bit of SFTP before so we won't go into detail here but if you forgot, go have a look at the networking exercises in the resources directory.
I'm mentioning it because it's crucial to remember it's existence in order to understand the next topic, sshfs.
## SSHFS
Thanks to the sftp subsystem of ssh we can use it to copy files form one system to an other.
Some clever guy's used it to build [sshfs]() which mounts a remote folder into our system so we can use it like a network share.
It's a poor mans NFS that can be a true lifesaver.
You'll have to install it onto the client where you want to mount the folder to.
This can be done as follows, `sudo apt install sshfs`.
The server just needs a running sshd process with the internal-sftp subsystem configured but most, if not all, default ssh servers have this.
```
➜ ~ git:(master) ✗ ls media/sshfs
➜ ~ git:(master) ✗ sshfs waldek@172.30.4.19:/home/waldek media/sshfs
➜ ~ git:(master) ✗ ls media/sshfs
basement_session_1 broken_machines downloads go ipdb mbox sources test.sh
bigone.ovpn configuration gitea.service homeserver.yaml linux64.out media test.py
➜ ~ git:(master) ✗ df -h
Filesystem Size Used Avail Use% Mounted on
udev 5.8G 0 5.8G 0% /dev
tmpfs 1.2G 40M 1.2G 4% /run
/dev/mapper/helloworld--vg-root 226G 165G 50G 77% /
tmpfs 5.9G 87M 5.8G 2% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 5.9G 0 5.9G 0% /sys/fs/cgroup
/dev/sda1 236M 129M 95M 58% /boot
tmpfs 1.2G 0 1.2G 0% /run/user/998
tmpfs 1.2G 24K 1.2G 1% /run/user/1000
waldek@172.30.4.19:/home/waldek 219G 99G 109G 48% /home/waldek/media/sshfs
➜ ~ git:(master) ✗
```
Once you're done with the share you can unmount it as follows.
```
➜ ~ git:(master) ✗ ls media/sshfs
basement_session_1 broken_machines downloads go ipdb mbox sources test.sh
bigone.ovpn configuration gitea.service homeserver.yaml linux64.out media test.py
➜ ~ git:(master) ✗ sudo umount media/sshfs
➜ ~ git:(master) ✗ ls media/sshfs
➜ ~ git:(master) ✗
```
## Tweaking the sshd configuration file
All server configuration is done in the `/etc/ssh/sshd_config` file.
@ -348,11 +394,7 @@ Protocol
## Tunnels
## SFTP
## Autossh
## SSHFS
## SSHuttle