Tag Archives: ssh

ssh allow all users from lan, restrict users from wan

Raspberry pi used as ssh server at home.
DMZ enabled to it’s IP.


file: /etc/ssh/sshd_config

AllowUsers *@192.168.0.* johndoe

This directive will allow only johndoe to connect via ssh unless the connection attempt comes from the same network, in which case alice will be able to connect, too. If alice tries to connect from the DMZ, it won’t work.

(slightly) faster ssh connection

If you will only connect using password authentication, lets say using sshpass, you can slightly improve the connection time by (forcing) using password authentication first.


ssh -o "PreferredAuthentications password" user@server

ssh port redirection

[internet]—[server]–[raspberrypi]

[server]= 192.168.0.2
[raspberrypi]=192.168.0.3

run this on [server] to make [raspberrypi:8080] available on the [internet].
ssh -p 25111 johndoe@192.168.0.2 -L *:8080:192.168.0.3:8080

[server] uses a non standard ssh port: 25111.

resuming ssh transfers with rsync

how to send and/or resume:

rsync --partial --progress --rsh=ssh tarball_with_legal-files.tar.gz root@example.net:/mnt/directory/ --bwlimit=KBPS

–partial: will resume files already present on remote server
–progress: show progress bar
–rsh: remote shell
–bwlimit: I/O limit on local, this will impact the net bandwidth used.