Skip to content

Commit

Permalink
Added some code
Browse files Browse the repository at this point in the history
  • Loading branch information
Randy8080 committed Jul 13, 2021
1 parent daea691 commit 2042cb9
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions ssh.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ Connect on a specific port
```shell script
$ ssh [email protected] -p 6222
```
Connect via pem file (0600 permissions)
Connect via pem file (0400 permissions)
```shell script
$ ssh -i /path/file.pem [email protected]
```
See: [SSH Permissions](/chmod#ssh-permissions)

### Executing
Executes remote command
Expand All @@ -47,7 +48,7 @@ $ ssh [email protected] "tar cvzf - ~/source" > output.tgz



### scp {.row-span-2}
### SCP {.row-span-2}

Copies from remote to local
```shell script
Expand Down Expand Up @@ -76,23 +77,26 @@ $ scp user@server:/dir/* .


### Config location
System-wide ssh config
```shell script
/etc/ssh/ssh_config
```
User-specific ssh config
```shell script
~/.ssh/config
```
| File Path | Description |
|--------------------------|----------------------|
| `/etc/ssh/ssh_config` | System-wide config |
| `~/.ssh/config` | User-specific config |
| `~/.ssh/id_{type}` | Private key |
| `~/.ssh/id_{type}.pub` | Public key |
| `~/.ssh/known_hosts` | Logged in host |
| `~/.ssh/authorized_keys` | Authorized login key |


### SCP Options

| Options | Description |
|---------------|----------------------|
| scp `-C` | <yel>C</yel>ompresses data |
| scp `-v` | Prints <yel>v</yel>erbose info |
| scp `-P` 8080 | Uses a specific <yel>P</yel>ort |
| Options | Description |
|---------------|------------------------------------------------|
| scp `-r` | <yel>R</yel>ecursively copy entire directories |
| scp `-C` | <yel>C</yel>ompresses data |
| scp `-v` | Prints <yel>v</yel>erbose info |
| scp `-P` 8080 | Uses a specific <yel>P</yel>ort |
| scp `-B` | <yel>B</yel>atch mode _(Prevents password)_ |
| scp `-p` | <yel>P</yel>reserves times and modes |


### Config sample
Expand Down Expand Up @@ -148,17 +152,17 @@ $ ssh-copy-id -i ~/.ssh/id_rsa.pub user@server
SSH keygen {.cols-5}
---------------

### Explain {.col-span-2}
### ssh-keygen {.col-span-2}

```shell script
$ ssh-keygen -t rsa -b 4096 -C "[email protected]"
```
----
|- | - | - |
|---|---------------|---------------------------|
| | `-t` | [Type](#key-type) of key |
| | `-b` | The number of bits in the key |
| | `-C` | Provides a new comment |
| - | - | - |
|---|------|-------------------------------|
| | `-t` | [Type](#key-type) of key |
| | `-b` | The number of bits in the key |
| | `-C` | Provides a new comment |
{.left-text}

Generate an RSA 4096 bit key with email as a comment
Expand Down

0 comments on commit 2042cb9

Please sign in to comment.