Fixed behaviour when using ssh config alias

This commit is contained in:
2026-05-02 13:06:11 +03:00
parent bd31e95992
commit 9e3a061ddd
2 changed files with 138 additions and 16 deletions

View File

@@ -1,4 +1,5 @@
# sshukh zsh plugin
*SSH Update Known Hosts*
Prompts to update `known_hosts` file for you if needed.
@@ -6,25 +7,33 @@ 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 pi@192.168.1.54
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@ -45,4 +54,5 @@ Update known_hosts? [y/n] y
/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.
There is a prompt asking if you want to remove the conflicting host from `known_hosts` and upon answering `y` ssh reruns automatically successfully.