Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/anatolykopyl/sshukh

Plugin to update known hosts automatically if needed
https://github.com/anatolykopyl/sshukh

oh-my-zsh oh-my-zsh-plugin ssh zsh zsh-plugin

Last synced: 2 months ago
JSON representation

Plugin to update known hosts automatically if needed

Lists

README

        

# sshukh zsh plugin
*SSH Update Known Hosts*

Prompts to update `known_hosts` file for you if needed.

## Installation:

**With Oh-my-zsh:** run the following command:
```
$ git clone https://github.com/anatolykopyl/sshukh.git $HOME/.oh-my-zsh/custom/plugins/sshukh
```
**With Antigen:** add the following to your `.zshrc`:
```
antigen bundle anatolykopyl/sshukh
```

To always use with ssh (recommended) add this alias to your `.zshrc`:
```
alias ssh='sshukh'
```
Zsh may tell you that the plugin is disabled until permissions are fixed. Just run the command it suggests.
```
$ compaudit | xargs chmod g-w,o-w
```

## Usage
Let's connect to an ip that changed hosts:
```
$ sshukh [email protected]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:vOsLgBskwRk1pvSpgpALYpdi/9WZ5OGB5iI+80Zkdg8.
Please contact your system administrator.
Add correct host key in /Users/akopyl/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/akopyl/.ssh/known_hosts:26
ECDSA host key for 192.168.1.54 has changed and you have requested strict checking.
Host key verification failed.
Update known_hosts? [y/n] y
# Host 192.168.1.54 found: line 26
/Users/akopyl/.ssh/known_hosts updated.
Original contents retained as /Users/akopyl/.ssh/known_hosts.old
```
There is a prompt asking if you want to remove the conflicting host from `known_hosts` and upon answering `y` ssh reruns automatically successfully.