Skip to content

shumatics/update-ssh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

update-ssh

License

πŸ“ Description

When you are trying to connect to a server via SSH. You can get the errors below:

  1. host key verification failed ssh
  2. ssh known_hosts error
  3. ssh host key verification failed fix

This error is caused by:

  1. The server has been reinstalled or upgraded, which may have generated a new host key or changed the host key format or algorithm.
  2. The server has rotated its host key, which is a good security practice to prevent the host key from being compromised or leaked.
  3. The network configuration of the server has changed, such as the IP address or the hostname.
  4. The known_hosts file on the client has been altered or corrupted, which may have deleted or modified the host key entry for the server.

Instead of modifying the known_hosts file. I created a small script which update the key for you.

It will take the ip and the port number of the server and update the old key to the new host key.

πŸ“ Project Structure

.
β”œβ”€β”€ LICENSE
└── update-ssh.sh

Instructions

  1. Clone the this repo main branch to your desktop.
  2. Open the folder and use this command to make the .sh exec. chmod +x kill-port.sh
  3. Link this folder to your .zshrc. This is mainly located in ~/.zshrc
  4. Use nano or vim to edit .zshrc
  5. Add the line to your .zshrc : export PATH="$PATH:{folder}/update-ssh"
  6. Replace {folder} with the correct path to this project

Once setup, write source .zshrc to apply the new changes

On your terminal, you can use it like below

update-ssh.sh -p {port} -i {ip}

Replace {port} and {ip} with the ssh IP and port number.

It will output if the script found the IP and port in known_hosts and updates it. The original content will save in known_hosts.old

πŸ‘₯ Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Clone your fork: git clone https://github.com/shumatics/update-ssh.git
  3. Create a new branch: git checkout -b feature/your-feature
  4. Commit your changes: git commit -am 'Add some feature'
  5. Push to your branch: git push origin feature/your-feature
  6. Open a pull request

Please ensure your code follows the project's style guidelines and includes tests where applicable.

πŸ“œ License

This project is licensed under the LICENSE License.


This README was generated with ❀️ by ReadmeBuddy

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages