Skip to content

Instantly share code, notes, and snippets.

@roommen
Last active November 7, 2024 09:28
Show Gist options
  • Save roommen/18cd78d07b0fbc962de4e79c1d468f92 to your computer and use it in GitHub Desktop.
Save roommen/18cd78d07b0fbc962de4e79c1d468f92 to your computer and use it in GitHub Desktop.
OpenSSH Update Script - Amazon Linux 2
#!/bin/bash
sudo yum install gcc -y
sudo yum install openssl-devel -y
sudo yum install zlib-devel -y
sudo yum install mlocate -y
sudo yum install autoconf -y
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.1p1.tar.gz
tar zxvf openssh-9.1p1.tar.gz
cd openssh-9.1p1 && ./configure && make && sudo make install
@prmichaelsen
Copy link

smh this broke my clones

@Gino1024
Copy link

Gino1024 commented Nov 7, 2024

sed -i '129a\#include <systemd/sd-daemon.h>' sshd.c
sed -i '2095a\        /* Signal systemd that we are ready to accept connections */' sshd.c
sed -i '2096a\        sd_notify (0, "READY=1");' sshd.c

Hi everyone, I also updated OpenSSH on EC2 this week. After performing the above steps,
systemctl restart sshd executes successfully but the client cannot connect via ssh.

I think there may be some problem with the original ec2 sshkey after the update?

Has anyone else encountered a similar situation and fixed it?

Hope to get the answer... QQ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment