Autosave: 2025-03-14 17:01:58

This commit is contained in:
thomasabishop 2025-03-14 17:01:58 +00:00
parent 8dbbbe92a2
commit a2b65df7a4
843 changed files with 441 additions and 8 deletions

View file

@ -0,0 +1,77 @@
---
tags: [encryption, shell, server-management]
created: Tuesday, March 04, 2025
---
# SSH
SSH is the de facto standard for remote access to a Unix machine.
`ssh` is the client which you use to connect to another machine.
`sshd` is the server that manages incoming client requests for access.
## sshd
Typically the SSH server will be turned off.
To run at boot:
```sh
sudo systemctl enable sshd
```
To start immediately:
```sh
sudo systemctl start sshd
```
The `sshd` configuration is found in the directory `/etc/ssh`.
The config file is `/etc/ssh/sshd_config`.
Mostly you can leave this alone but the following is a useful property to set:
```
PermitRootLogin no
```
See [Disable non-root ssh access](Disable_non-root_ssh_access.md) for more.
## Known hosts
Within your home directory at `./ssh/known_hosts` you will find a record of all
the public keys of the servers you have connected. This file exists for both
servers and clients, e.g:
```sh
cat ./ssh/known_hosts
# systemsobscure.net ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKn6vyv9b+Nk5r
# YVSAk5KvsTiC24K6uSpzCHzgLNoqt2
```
This shows the public key of my server at `systemsobscure.net` along with
others.
## Authorized keys
On servers only, there is also an `authorized_keys` file which shows the
server's own public keys that it presents to clients.
If I go to my server I see that this key matches the one I have on my client
computer `known_hosts`:
```sh
sudo cat /etc/ssh/ssh_host_ed25519_key.pub
# ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKn6vyv9b+Nk5rYVSAk5KvsTiC24K6uSpzCHzgLNoqt2 root@self-host-server
```
Each user on a server will also have a `~/.ssh` directory also containing an
`authorized_keys` file. This contains the public keys of clients who are allowed
to connect to that user account.
Hence I see the same public key of my desktop client machine in both places.
## How the tunnel is created

View file

@ -0,0 +1,28 @@
---
tags: [protocols, USB]
created: Wednesday, March 12, 2025
---
# USB protocols and connectors
Different USB connectors can transfer according to different protocols. A
connector is not always tied to a specific protocol. For instance each
subsequent generation of connector is typically backwards-compatible with the
protocol of the connector that it superseded.
Some connectors are limited to slower protocols but they have the example of
being small which is a benefit for smaller devices. The USB-C connector is so
good because it is both small and capable of supporting the most advanced
protocols (USB-4 and Thunderbolt).
The main types of USB connector:
- USB-A/USB-B
- USB-A/USB-B
- Micro-USB ()
- Mini-USB
- USB-C
The illustration below matches connector to the protocol supported:
![](static/usb-illustration.png)

View file

@ -0,0 +1,37 @@
---
tags: [hardware, usb]
created: Wednesday, March 12, 2025
---
# USB-C
The "C" in the name refers to the shape of the _connector_ not the protocol that
is used for the data transfer. (This is the case for all USB "types" which makes
things confusing.)
Multiple protocols can use the same connector for input/output. For instance
Thunderbolt can transfer over USB-C but not every port that can fit a USB-C is a
Thunderbolt port. The device's internal hardware determines the protocols
available.
The USB-C connector can serve all of the following protocols (from slowest to
fastest):
- USB 1.0 (12mb/s)
- USB 2.0 (480Mb/s)
- USB 3.0 (5Gb/s)
- USB 3.1 (10Gb/s)
- USB 3.2 (20Gb/s)
- USB 4 (40Gb/s)
- Thunderbolt (40Gb/s)
A USB-C connector is equipped to just charge a device as well as transfer data.
The world is converging (often due to legislation) on USB-C as the global
standard. It can be one connector for all existing protocols and future
protocols (for about 15 years). Its physical design an form factor can support
future advancements whilst using the same connector.
Ultimately USB-C will be surpassed by more another yet more advanced connector
and associated protocols but for the time being we can stop using the older
models.

View file

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View file

@ -13,12 +13,16 @@ computer science.
<a href="https://thomasabishop.github.io/eolas/tags">View tags</a>
**Build ID:** 5607f042-29e2-4baf-8022-e34dadc3ad0f
**Build ID:** 7aecb0c4-f9f9-4579-9564-8a4cb5e9c958
**Published:** Sun 02 Mar 2025 15:06:38
**Published:** Fri 14 Mar 2025 17:01:53
### Recent edits
- [[USB-C]]
- [[USB protocols and connectors]]
- [[SSH]]
- [[lsof]]
- [[a0ab0bfb_network_layer_clarification]]
- [[b01fd836_Transport_Layer_clarification]]
- [[Transport_Layer_of_Internet_Protocol]]
@ -35,13 +39,9 @@ computer science.
- [[Setup encrypted harddrive]]
- [[Disk_size_utilities]]
- [[Let's_Encrypt]]
- [[Certificate_authorities]]
- [[Bash_colour_output]]
- [[e383b8b3_nginx_vs_traefik]]
- [[Proxies]]
### All notes (537)
### All notes (541)
- [[0716531c_rewilding_the_internet]]
- [[241fe1a3_the_Web_versus_modem_BBSs]]
@ -444,6 +444,7 @@ computer science.
- [[S3]]
- [[SAM]]
- [[SQLite]]
- [[SSH]]
- [[Save_readonly_Vim_file]]
- [[Schema_Definition_Language_in_GraphQL]]
- [[Secrets_or_env_vars_in_AWS]]
@ -509,6 +510,8 @@ computer science.
- [[Type_hinting]]
- [[Typing_built_in_React_hooks]]
- [[UFW_firewall_management]]
- [[USB protocols and connectors]]
- [[USB-C]]
- [[Union_types_in_TS]]
- [[Unknown_type_in_TS]]
- [[Update_a_Mongo_document]]
@ -573,6 +576,7 @@ computer science.
- [[http_in_Node]]
- [[journald]]
- [[jq]]
- [[lsof]]
- [[ps]]
- [[python_advent_learnings]]
- [[systemd]]

View file

@ -0,0 +1,65 @@
---
tags: [shell, procedural]
created: Tuesday, March 04, 2025
---
# lsof
`lsof` stands for _list open files_. It lists opened files and the processes
using them.
## Directory
```sh
lsof /home/thomas
```
```
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
pipewire 1025 thomas cwd DIR 253,0 4096 7340035 /home/thomas
wireplumb 1026 thomas cwd DIR 253,0 4096 7340035 /home/thomas
```
## Pass in a pid
```sh
lsof -p 1175
```
```
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
at-spi-bu 1175 thomas cwd DIR 253,0 4096 7340035 /home/thomas
at-spi-bu 1175 thomas rtd DIR 259,2 4096 2 /
at-spi-bu 1175 thomas txt REG 259,2 26760 1225154 /usr/lib/at-spi-bus-launcher
```
## Networking
### List programs using or listening to ports
```sh
lsof -i
```
```
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
signal-de 3250 thomas 39u IPv4 149863 0t0 TCP archlinux:44304->ac88393aca5853df7.awsglobalaccelerator.com:https (ESTABLISHED)
slack 3602 thomas 18u IPv4 138442 0t0 TCP archlinux:57950->ec2-18-169-55-40.eu-west-2.compute.amazonaws.com:https (ESTABLISHED)
firefox 6177 thomas 147u IPv4 138842 0t0 TCP archlinux:cresco-control->93.243.107.34.bc.googleusercontent.com:https (ESTABLISHED)
```
### Filter by specific port
```sh
lsof -i:22
lsof -i4:22 # limit to IPv4 addresses
```
```
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
sshd 45448 root 3u IPv4 640237 0t0 TCP *:ssh (LISTEN)
sshd 45448 root 4u IPv6 640239 0t0 TCP *:ssh (LISTEN)
sshd 185660 root 4u IPv4 2554538 0t0 TCP static.18.113.203.116.clients.your-server.de:ssh->0542cb12.skybroadband.com:57744 (ESTABLISHED)
```

View file

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View file

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 145 KiB

View file

Before

Width:  |  Height:  |  Size: 289 KiB

After

Width:  |  Height:  |  Size: 289 KiB

View file

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View file

Before

Width:  |  Height:  |  Size: 6.9 MiB

After

Width:  |  Height:  |  Size: 6.9 MiB

View file

Before

Width:  |  Height:  |  Size: 224 KiB

After

Width:  |  Height:  |  Size: 224 KiB

View file

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

View file

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View file

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View file

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View file

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View file

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

View file

Before

Width:  |  Height:  |  Size: 204 KiB

After

Width:  |  Height:  |  Size: 204 KiB

View file

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View file

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View file

Before

Width:  |  Height:  |  Size: 165 KiB

After

Width:  |  Height:  |  Size: 165 KiB

View file

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View file

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

View file

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 133 KiB

View file

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View file

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View file

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 4 KiB

View file

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View file

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View file

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View file

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View file

Before

Width:  |  Height:  |  Size: 148 KiB

After

Width:  |  Height:  |  Size: 148 KiB

View file

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View file

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View file

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View file

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 121 KiB

View file

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View file

Before

Width:  |  Height:  |  Size: 470 KiB

After

Width:  |  Height:  |  Size: 470 KiB

View file

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View file

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

View file

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 99 KiB

View file

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View file

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View file

Before

Width:  |  Height:  |  Size: 848 KiB

After

Width:  |  Height:  |  Size: 848 KiB

View file

Before

Width:  |  Height:  |  Size: 194 KiB

After

Width:  |  Height:  |  Size: 194 KiB

View file

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View file

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View file

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 130 KiB

View file

Before

Width:  |  Height:  |  Size: 171 KiB

After

Width:  |  Height:  |  Size: 171 KiB

View file

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View file

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

View file

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View file

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 79 KiB

View file

Before

Width:  |  Height:  |  Size: 157 KiB

After

Width:  |  Height:  |  Size: 157 KiB

View file

Before

Width:  |  Height:  |  Size: 183 KiB

After

Width:  |  Height:  |  Size: 183 KiB

View file

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View file

Before

Width:  |  Height:  |  Size: 153 KiB

After

Width:  |  Height:  |  Size: 153 KiB

View file

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View file

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 87 KiB

View file

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View file

Before

Width:  |  Height:  |  Size: 414 KiB

After

Width:  |  Height:  |  Size: 414 KiB

View file

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View file

Before

Width:  |  Height:  |  Size: 174 KiB

After

Width:  |  Height:  |  Size: 174 KiB

View file

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View file

Before

Width:  |  Height:  |  Size: 167 KiB

After

Width:  |  Height:  |  Size: 167 KiB

View file

Before

Width:  |  Height:  |  Size: 150 KiB

After

Width:  |  Height:  |  Size: 150 KiB

View file

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View file

Before

Width:  |  Height:  |  Size: 140 KiB

After

Width:  |  Height:  |  Size: 140 KiB

View file

Before

Width:  |  Height:  |  Size: 190 KiB

After

Width:  |  Height:  |  Size: 190 KiB

View file

Before

Width:  |  Height:  |  Size: 374 KiB

After

Width:  |  Height:  |  Size: 374 KiB

View file

Before

Width:  |  Height:  |  Size: 9 KiB

After

Width:  |  Height:  |  Size: 9 KiB

View file

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

View file

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View file

Before

Width:  |  Height:  |  Size: 448 KiB

After

Width:  |  Height:  |  Size: 448 KiB

View file

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 122 KiB

View file

Before

Width:  |  Height:  |  Size: 668 KiB

After

Width:  |  Height:  |  Size: 668 KiB

View file

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View file

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View file

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View file

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 108 KiB

View file

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View file

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View file

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View file

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View file

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View file

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View file

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View file

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View file

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View file

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View file

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View file

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View file

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View file

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View file

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

View file

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View file

Before

Width:  |  Height:  |  Size: 146 KiB

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 KiB

View file

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View file

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

View file

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

View file

@ -4,7 +4,7 @@ unlisted: true
---
# Tags
[algebra](./tags#algebra), [algorithms](./tags#algorithms), [analogue](./tags#analogue), [android](./tags#android), [APIs](./tags#APIs), [arch-linux](./tags#arch-linux), [arithmetic](./tags#arithmetic), [ARPA](./tags#ARPA), [ARPANET](./tags#ARPANET), [awk](./tags#awk), [AWS](./tags#AWS), [aws-lambda](./tags#aws-lambda), [binary](./tags#binary), [bulletin-boards](./tags#bulletin-boards), [bus](./tags#bus), [C](./tags#C), [computer-architecture](./tags#computer-architecture), [computer-history](./tags#computer-history), [containerization](./tags#containerization), [CPU](./tags#CPU), [cryptography](./tags#cryptography), [csv](./tags#csv), [data-structures](./tags#data-structures), [data-types](./tags#data-types), [databases](./tags#databases), [design-patterns](./tags#design-patterns), [disks](./tags#disks), [docker](./tags#docker), [dynamodb](./tags#dynamodb), [ecopolsoc](./tags#ecopolsoc), [electricity](./tags#electricity), [electromagnetism](./tags#electromagnetism), [electronics](./tags#electronics), [encryption](./tags#encryption), [exponents](./tags#exponents), [file-system](./tags#file-system), [firewalls](./tags#firewalls), [fleeting](./tags#fleeting), [fractions](./tags#fractions), [git](./tags#git), [graphql](./tags#graphql), [hardware](./tags#hardware), [IaC](./tags#IaC), [internet](./tags#internet), [javascript](./tags#javascript), [jest](./tags#jest), [json](./tags#json), [JSON](./tags#JSON), [kernel](./tags#kernel), [Linux](./tags#Linux), [linux](./tags#linux), [literature](./tags#literature), [logic](./tags#logic), [logic-gates](./tags#logic-gates), [memory](./tags#memory), [Microsoft](./tags#Microsoft), [middleware](./tags#middleware), [modems](./tags#modems), [mongo-db](./tags#mongo-db), [mongoose](./tags#mongoose), [nand-to-tetris](./tags#nand-to-tetris), [network-protocols](./tags#network-protocols), [networks](./tags#networks), [node-js](./tags#node-js), [number-systems](./tags#number-systems), [number-theory](./tags#number-theory), [OOP](./tags#OOP), [operating-systems](./tags#operating-systems), [packet-switching](./tags#packet-switching), [physics](./tags#physics), [ports](./tags#ports), [prealgebra](./tags#prealgebra), [privacy](./tags#privacy), [procedural](./tags#procedural), [propositional-logic](./tags#propositional-logic), [proxies](./tags#proxies), [python](./tags#python), [question](./tags#question), [raspberry-pi](./tags#raspberry-pi), [react](./tags#react), [recursion](./tags#recursion), [regex](./tags#regex), [REST](./tags#REST), [S3](./tags#S3), [server-management](./tags#server-management), [set-theory](./tags#set-theory), [shell](./tags#shell), [SNS](./tags#SNS), [sound](./tags#sound), [SQL](./tags#SQL), [SQLite](./tags#SQLite), [SQS](./tags#SQS), [ssh](./tags#ssh), [storage](./tags#storage), [surveillance-capitalism](./tags#surveillance-capitalism), [systemd](./tags#systemd), [systems-programming](./tags#systems-programming), [testing](./tags#testing), [theorems](./tags#theorems), [theory-of-computation](./tags#theory-of-computation), [time](./tags#time), [TOR](./tags#TOR), [Turing](./tags#Turing), [typescript](./tags#typescript), [unix](./tags#unix), [VPN](./tags#VPN), [world-wide-web](./tags#world-wide-web), [yaml](./tags#yaml),
[algebra](./tags#algebra), [algorithms](./tags#algorithms), [analogue](./tags#analogue), [android](./tags#android), [APIs](./tags#APIs), [arch-linux](./tags#arch-linux), [arithmetic](./tags#arithmetic), [ARPA](./tags#ARPA), [ARPANET](./tags#ARPANET), [awk](./tags#awk), [AWS](./tags#AWS), [aws-lambda](./tags#aws-lambda), [binary](./tags#binary), [bulletin-boards](./tags#bulletin-boards), [bus](./tags#bus), [C](./tags#C), [computer-architecture](./tags#computer-architecture), [computer-history](./tags#computer-history), [containerization](./tags#containerization), [CPU](./tags#CPU), [cryptography](./tags#cryptography), [csv](./tags#csv), [data-structures](./tags#data-structures), [data-types](./tags#data-types), [databases](./tags#databases), [design-patterns](./tags#design-patterns), [disks](./tags#disks), [docker](./tags#docker), [dynamodb](./tags#dynamodb), [ecopolsoc](./tags#ecopolsoc), [electricity](./tags#electricity), [electromagnetism](./tags#electromagnetism), [electronics](./tags#electronics), [encryption](./tags#encryption), [exponents](./tags#exponents), [file-system](./tags#file-system), [firewalls](./tags#firewalls), [fleeting](./tags#fleeting), [fractions](./tags#fractions), [git](./tags#git), [graphql](./tags#graphql), [hardware](./tags#hardware), [IaC](./tags#IaC), [internet](./tags#internet), [javascript](./tags#javascript), [jest](./tags#jest), [json](./tags#json), [JSON](./tags#JSON), [kernel](./tags#kernel), [Linux](./tags#Linux), [linux](./tags#linux), [literature](./tags#literature), [logic](./tags#logic), [logic-gates](./tags#logic-gates), [memory](./tags#memory), [Microsoft](./tags#Microsoft), [middleware](./tags#middleware), [modems](./tags#modems), [mongo-db](./tags#mongo-db), [mongoose](./tags#mongoose), [nand-to-tetris](./tags#nand-to-tetris), [network-protocols](./tags#network-protocols), [networks](./tags#networks), [node-js](./tags#node-js), [number-systems](./tags#number-systems), [number-theory](./tags#number-theory), [OOP](./tags#OOP), [operating-systems](./tags#operating-systems), [packet-switching](./tags#packet-switching), [physics](./tags#physics), [ports](./tags#ports), [prealgebra](./tags#prealgebra), [privacy](./tags#privacy), [procedural](./tags#procedural), [propositional-logic](./tags#propositional-logic), [protocols](./tags#protocols), [proxies](./tags#proxies), [python](./tags#python), [question](./tags#question), [raspberry-pi](./tags#raspberry-pi), [react](./tags#react), [recursion](./tags#recursion), [regex](./tags#regex), [REST](./tags#REST), [S3](./tags#S3), [server-management](./tags#server-management), [set-theory](./tags#set-theory), [shell](./tags#shell), [SNS](./tags#SNS), [sound](./tags#sound), [SQL](./tags#SQL), [SQLite](./tags#SQLite), [SQS](./tags#SQS), [ssh](./tags#ssh), [storage](./tags#storage), [surveillance-capitalism](./tags#surveillance-capitalism), [systemd](./tags#systemd), [systems-programming](./tags#systems-programming), [testing](./tags#testing), [theorems](./tags#theorems), [theory-of-computation](./tags#theory-of-computation), [time](./tags#time), [TOR](./tags#TOR), [Turing](./tags#Turing), [typescript](./tags#typescript), [unix](./tags#unix), [USB](./tags#USB), [usb](./tags#usb), [VPN](./tags#VPN), [world-wide-web](./tags#world-wide-web), [yaml](./tags#yaml),
### algebra
@ -371,6 +371,7 @@ unlisted: true
- [[HTTPS]]
- [[Let's_Encrypt]]
- [[Setup encrypted harddrive]]
- [[SSH]]
- [[What_can_the_ISP_see]]
### exponents
@ -440,6 +441,7 @@ unlisted: true
- [[Machine_code]]
- [[Motherboard]]
- [[Network_card]]
- [[USB-C]]
### IaC
- [[Terraform]]
@ -865,6 +867,7 @@ unlisted: true
- [[Killing_processes]]
- [[LineageOS_backup]]
- [[Linux_disk_partitions]]
- [[lsof]]
- [[Monitor_DNS_resolution_and_internet_connectivity_script]]
- [[Monitoring_processes_and_resources]]
- [[Network_packet_analysis_tools]]
@ -919,6 +922,9 @@ unlisted: true
- [[Truth_tables]]
- [[Truth_trees]]
- [[Validity_and_entailment]]
### protocols
- [[USB protocols and connectors]]
### proxies
- [[e383b8b3_nginx_vs_traefik]]
@ -1033,6 +1039,7 @@ unlisted: true
- [[Firewalls]]
- [[HTTPS]]
- [[Let's_Encrypt]]
- [[SSH]]
- [[UFW_firewall_management]]
### set-theory
@ -1068,6 +1075,7 @@ unlisted: true
- [[Listing_and_navigating_directories_in_the_Shell]]
- [[Lists_and_arrays_in_Bash]]
- [[Loops_in_bash]]
- [[lsof]]
- [[Passing_arguments_and_options_to_Bash_scripts]]
- [[Proper_shebang_syntax]]
- [[ps]]
@ -1077,6 +1085,7 @@ unlisted: true
- [[Redirection_in_Bash]]
- [[Shell_sessions]]
- [[Split_into_array_in_Bash]]
- [[SSH]]
- [[Strings_in_Bash]]
- [[Substrings_in_Bash]]
- [[Symlinks]]
@ -1212,6 +1221,12 @@ unlisted: true
### unix
- [[Time_and_computers]]
### USB
- [[USB protocols and connectors]]
### usb
- [[USB-C]]
### VPN
- [[How_tunneling_works_with_VPNs]]

Binary file not shown.

77
zk/SSH.md Normal file
View file

@ -0,0 +1,77 @@
---
tags: [encryption, shell, server-management]
created: Tuesday, March 04, 2025
---
# SSH
SSH is the de facto standard for remote access to a Unix machine.
`ssh` is the client which you use to connect to another machine.
`sshd` is the server that manages incoming client requests for access.
## sshd
Typically the SSH server will be turned off.
To run at boot:
```sh
sudo systemctl enable sshd
```
To start immediately:
```sh
sudo systemctl start sshd
```
The `sshd` configuration is found in the directory `/etc/ssh`.
The config file is `/etc/ssh/sshd_config`.
Mostly you can leave this alone but the following is a useful property to set:
```
PermitRootLogin no
```
See [Disable non-root ssh access](./Disable_non-root_ssh_access.md) for more.
## Known hosts
Within your home directory at `./ssh/known_hosts` you will find a record of all
the public keys of the servers you have connected. This file exists for both
servers and clients, e.g:
```sh
cat ./ssh/known_hosts
# systemsobscure.net ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKn6vyv9b+Nk5r
# YVSAk5KvsTiC24K6uSpzCHzgLNoqt2
```
This shows the public key of my server at `systemsobscure.net` along with
others.
## Authorized keys
On servers only, there is also an `authorized_keys` file which shows the
server's own public keys that it presents to clients.
If I go to my server I see that this key matches the one I have on my client
computer `known_hosts`:
```sh
sudo cat /etc/ssh/ssh_host_ed25519_key.pub
# ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKn6vyv9b+Nk5rYVSAk5KvsTiC24K6uSpzCHzgLNoqt2 root@self-host-server
```
Each user on a server will also have a `~/.ssh` directory also containing an
`authorized_keys` file. This contains the public keys of clients who are allowed
to connect to that user account.
Hence I see the same public key of my desktop client machine in both places.
## How the tunnel is created

View file

@ -0,0 +1,28 @@
---
tags: [protocols, USB]
created: Wednesday, March 12, 2025
---
# USB protocols and connectors
Different USB connectors can transfer according to different protocols. A
connector is not always tied to a specific protocol. For instance each
subsequent generation of connector is typically backwards-compatible with the
protocol of the connector that it superseded.
Some connectors are limited to slower protocols but they have the example of
being small which is a benefit for smaller devices. The USB-C connector is so
good because it is both small and capable of supporting the most advanced
protocols (USB-4 and Thunderbolt).
The main types of USB connector:
- USB-A/USB-B
- USB-A/USB-B
- Micro-USB ()
- Mini-USB
- USB-C
The illustration below matches connector to the protocol supported:
![](../img/usb-illustration.png)

37
zk/USB-C.md Normal file
View file

@ -0,0 +1,37 @@
---
tags: [hardware, usb]
created: Wednesday, March 12, 2025
---
# USB-C
The "C" in the name refers to the shape of the _connector_ not the protocol that
is used for the data transfer. (This is the case for all USB "types" which makes
things confusing.)
Multiple protocols can use the same connector for input/output. For instance
Thunderbolt can transfer over USB-C but not every port that can fit a USB-C is a
Thunderbolt port. The device's internal hardware determines the protocols
available.
The USB-C connector can serve all of the following protocols (from slowest to
fastest):
- USB 1.0 (12mb/s)
- USB 2.0 (480Mb/s)
- USB 3.0 (5Gb/s)
- USB 3.1 (10Gb/s)
- USB 3.2 (20Gb/s)
- USB 4 (40Gb/s)
- Thunderbolt (40Gb/s)
A USB-C connector is equipped to just charge a device as well as transfer data.
The world is converging (often due to legislation) on USB-C as the global
standard. It can be one connector for all existing protocols and future
protocols (for about 15 years). Its physical design an form factor can support
future advancements whilst using the same connector.
Ultimately USB-C will be surpassed by more another yet more advanced connector
and associated protocols but for the time being we can stop using the older
models.

65
zk/lsof.md Normal file
View file

@ -0,0 +1,65 @@
---
tags: [shell, procedural]
created: Tuesday, March 04, 2025
---
# lsof
`lsof` stands for _list open files_. It lists opened files and the processes
using them.
## Directory
```sh
lsof /home/thomas
```
```
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
pipewire 1025 thomas cwd DIR 253,0 4096 7340035 /home/thomas
wireplumb 1026 thomas cwd DIR 253,0 4096 7340035 /home/thomas
```
## Pass in a pid
```sh
lsof -p 1175
```
```
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
at-spi-bu 1175 thomas cwd DIR 253,0 4096 7340035 /home/thomas
at-spi-bu 1175 thomas rtd DIR 259,2 4096 2 /
at-spi-bu 1175 thomas txt REG 259,2 26760 1225154 /usr/lib/at-spi-bus-launcher
```
## Networking
### List programs using or listening to ports
```sh
lsof -i
```
```
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
signal-de 3250 thomas 39u IPv4 149863 0t0 TCP archlinux:44304->ac88393aca5853df7.awsglobalaccelerator.com:https (ESTABLISHED)
slack 3602 thomas 18u IPv4 138442 0t0 TCP archlinux:57950->ec2-18-169-55-40.eu-west-2.compute.amazonaws.com:https (ESTABLISHED)
firefox 6177 thomas 147u IPv4 138842 0t0 TCP archlinux:cresco-control->93.243.107.34.bc.googleusercontent.com:https (ESTABLISHED)
```
### Filter by specific port
```sh
lsof -i:22
lsof -i4:22 # limit to IPv4 addresses
```
```
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
sshd 45448 root 3u IPv4 640237 0t0 TCP *:ssh (LISTEN)
sshd 45448 root 4u IPv6 640239 0t0 TCP *:ssh (LISTEN)
sshd 185660 root 4u IPv4 2554538 0t0 TCP static.18.113.203.116.clients.your-server.de:ssh->0542cb12.skybroadband.com:57744 (ESTABLISHED)
```