adds ssh config info
This commit is contained in:
parent
bb2e8e8d31
commit
6a07b2e632
|
@ -260,6 +260,65 @@ I'll let you figure it out by yourself but if you're stuck have a look at [this]
|
|||
|
||||
## Standard usage
|
||||
|
||||
The basic usage of ssh is what you've been doing up until now, logging into remote machines.
|
||||
Now that you know how to add keys for automated logins, it's time to learn a few handy tricks.
|
||||
The first one is a bit basic but handy non the less.
|
||||
You can add a command to execute after the `ssh $USER@$HOST` so it becomes as follows.
|
||||
In this particular case it shows me information about the mounted partitions.
|
||||
|
||||
```
|
||||
➜ ~ git:(master) ✗ ssh waldek@172.30.4.19 df -h
|
||||
Filesystem Size Used Avail Use% Mounted on
|
||||
udev 16G 0 16G 0% /dev
|
||||
tmpfs 3.2G 347M 2.8G 11% /run
|
||||
/dev/sda1 219G 99G 109G 48% /
|
||||
tmpfs 16G 16K 16G 1% /dev/shm
|
||||
tmpfs 5.0M 0 5.0M 0% /run/lock
|
||||
tmpfs 16G 0 16G 0% /sys/fs/cgroup
|
||||
tank 386G 128K 386G 1% /usr/share/zpool
|
||||
tank/set1 573G 187G 386G 33% /usr/share/zpool/set1
|
||||
tank/set2 386G 128K 386G 1% /usr/share/zpool/set2
|
||||
tank/set3 100M 128K 100M 1% /usr/share/zpool/set3
|
||||
tmpfs 3.2G 0 3.2G 0% /run/user/1000
|
||||
➜ ~ git:(master) ✗
|
||||
```
|
||||
|
||||
A second nice thing to know about is the `~/.ssh/config` file.
|
||||
In this file you can add shortcut's to hosts you often contact.
|
||||
As an example I would like to add a shortcut to my matrix server.
|
||||
|
||||
```
|
||||
➜ ~ git:(master) ✗ ssh matrixserver
|
||||
ssh: Could not resolve hostname matrixserver: No address associated with hostname
|
||||
```
|
||||
|
||||
To create the shortcut I append the following to my `~/.ssh/config` file.
|
||||
|
||||
```
|
||||
Host matrixserver
|
||||
Hostname 172.30.4.19
|
||||
Port 22
|
||||
User waldek
|
||||
IdentityFile ~/.ssh/id_rsa
|
||||
```
|
||||
|
||||
I can now log in as follows.
|
||||
|
||||
```
|
||||
➜ ~ git:(master) ✗ ssh matrixserver
|
||||
Linux debian 4.19.0-16-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64
|
||||
|
||||
The programs included with the Debian GNU/Linux system are free software;
|
||||
the exact distribution terms for each program are described in the
|
||||
individual files in /usr/share/doc/*/copyright.
|
||||
|
||||
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
|
||||
permitted by applicable law.
|
||||
You have new mail.
|
||||
Last login: Tue Jul 13 14:12:18 2021 from 172.30.40.99
|
||||
➜ ~
|
||||
```
|
||||
|
||||
## Tweaking the sshd configuration file
|
||||
|
||||
All server configuration is done in the `/etc/ssh/sshd_config` file.
|
||||
|
@ -283,6 +342,10 @@ Protocol
|
|||
“2,1” is identical to “1,2”.
|
||||
```
|
||||
|
||||
### Some classic security enhancements
|
||||
|
||||
### Tunneling and X forward
|
||||
|
||||
## Tunnels
|
||||
|
||||
## SFTP
|
||||
|
|
Loading…
Reference in New Issue