initial commit

This commit is contained in:
Malin Freeborn
2020-01-02 01:04:35 +01:00
commit 6befc5d3c1
162 changed files with 19086 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
#From Laptop
> ssh -f -N -T -R[highport]:localhost:22 [server username]@[server public ip]
#From Server
> sudo ssh -p [highport] -D localhost:22 [laptop username]@localhost
## Example
From laptop, type:
> ssh -f -N -T -R9022:localhost:22 pi@89.216.113.126
Then from server, type:
> ssh -p 2210 [laptop username]@localhost
#Explanations
The -f switch feels out for connections in the background.
The -N switch is 'No commands', as you don't actually need to tunnel to anywhere.
The -T disables pseudo-tty allocation (???).
#Longterm
To set this up for permanent access, add this to the ~/.ssh/config:
> host remotehostname
> User remoteusername
> Hostname localhost
> Port 22222
'Remotehostname' can be anything, but 'remoteusername' must match.
For example
```
host hostelche
User hostelche
Hostname localhost
Port 9071
```
# Automatic startup
set file in /etc/network/if-up.d/phone-home
> chmod 755 /etc/network/if-up.d/phone-home
set file /etc/rc.local
> chmod 755 rc.local
Both files contain:
```
#!/bin/bash
sleep 60
ssh -f -N -T -R2049:localhost:22 pi@89.216.113.126
```

4
networking/ssh/sshfs Normal file
View File

@@ -0,0 +1,4 @@
Auto-mounting an sshfs directory can be done with an /etc/fstab entry:
`sshfs#pi@belgradecats.tk:/home/pi/cats /home/ghost/cuties fuse defaults,allow_other,reconnect,delay_connect 0 0`

13
networking/ssh/sshfs.md Normal file
View File

@@ -0,0 +1,13 @@
# Mount
> sshfs alfred@192.168.0.14:Sync/Alfred
Various flags:
- Encryption: -C
- Map between local and remote user UIDs: -o idmap-user
# Unmount
> fusermount3 -u Sync/Alfred

17
networking/ssh/tricks.md Normal file
View File

@@ -0,0 +1,17 @@
Mount a remote filesystem locally with fuse-sshfs:
> sshfs ghost@192.168.0.10:/home/ghost /tmp/mnt
Unmount with:
> fusermount -u /tmp/mnt
Set it up on /etc/fstab with:
> sshfs#bkp@bkp.a-server.ninja:/media/store1/bkp /backup fuse defaults,allow_other,reconnect,delay_connect 0 0
Make image backup of sda1 and sda2 from one machine and pass it through ssh to another.
> for i in {1,2};do sudo dd if=/dev/sda$i | ssh -C ghost@192.168.0.10 "dd of=/mnt/Biggie/Backup/winback-oct-\"$i\".img" status=progress; done