Manually Compile OpenSSH Client: Custom Modifications Guide
Asked GPT how to manually compile the SSH client
Told me to download version 9.9p2 of the source code
I asked a follow-up question
openssh-9.9p2.tar.gz What date is this version? Is it compatible with my debian 13 environment?
Told me to download version 10.0p1
The following are personal notes, you can ignore them, follow the answer your GPT gave you. Because, whoever told you the answer, if something goes wrong, that's who you go to. Hehe
Prepare the environment and see if it can compile successfully first
# Download source code
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-10.0p1.tar.gz
# Extract
tar xzf openssh-10.0p1.tar.gz
cd openssh-10.0p1
# Install build dependencies
sudo apt update
sudo apt install -y \
build-essential \
libssl-dev \
zlib1g-dev \
pkg-config \
autoconf
# Configure build environment
./configure --prefix=/usr/local --without-pam
# Only build client-related targets, do not build sshd
make ssh ssh-keygen ssh-add ssh-agent ssh-keyscan
# Verify
./ssh -V
Success
Use the ssh compiled here to try logging into a VPS, success
Custom modification - Simply change the version number
Modify the version.h file
Compile
make ssh
Verify
Custom modification - Modify the prompt text when entering the password
Modify the sshconnect2.c file
Function static int userauth_passwd(struct ssh *ssh)
Modifications omitted
Verify
Custom modification - Save the password entered by the user
Modify the sshconnect2.c file
Function static int userauth_passwd(struct ssh *ssh)
Modifications omitted
Verify
Custom modification - Save the user's private key
Modify the sshconnect2.c file
Function static int userauth_pubkey(struct ssh *ssh)
Modifications omitted
Verify
========
Postscript
The GPT used this time is
========