Score:1

How to edit /usr/sbin/sshd File

om flag

Prevent SSH from advertising its version number

Here is what i am doing

cp /usr/sbin/sshd /tmp

ksh -o vi

cd /tmp

strings -t d -a -n 7 sshd | grep -i openssh

After i am getting this output

 149143 0@openssH
 244802  OPENSSHI
 244972 openssh-H9
 496496 OpenSSH_7.6p1 Ubuntu-4ubuntu0.7
 499144 [email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
 499440 [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
 499552 [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
 500399 OpenSSH_7.6p1
 500624 OpenSSH_7.6
 501314 none,[email protected]
 501504 [email protected]
 511114 [email protected]
 511283 [email protected]
 511361 [email protected]
 511390 [email protected]
 511501 [email protected]
 512112 [email protected]
 512840 [email protected]
 512984 [email protected]
 522092 [email protected]
 522944 [email protected]
 538476 [email protected]
 538501 [email protected]
 538522 [email protected]
 538543 [email protected]
 543975 openssh-key-v1
 544186 [email protected]
 544224 [email protected]
 544944 -----BEGIN OPENSSH PRIVATE KEY-----
 544984 -----END OPENSSH PRIVATE KEY-----
 545104 [email protected]
 545144 [email protected]
 545192 [email protected]
 545240 [email protected]
 547288 [email protected]
 553384 [email protected]
 557682 [email protected]
 557705 [email protected]
 557728 [email protected]
 557760 OpenSSH-2.0*,OpenSSH-2.1*,OpenSSH_2.1*,OpenSSH_2.2*
 558192 OpenSSH_2.5.0p1*,OpenSSH_2.5.1p1*
 558232 OpenSSH_2.5.0*,OpenSSH_2.5.1*,OpenSSH_2.5.2*
 558280 OpenSSH_2.*,OpenSSH_3.0*,OpenSSH_3.1*
 559218 OpenSSH_2.3.0*
 559233 OpenSSH_2.3.*
 559247 OpenSSH_2.5.3*
 559262 OpenSSH_3.*
 559287 OpenSSH_4*
 559298 OpenSSH_5*
 559309 OpenSSH_6.6.1*
 559324 OpenSSH_6.5*,OpenSSH_6.6*
 559350 OpenSSH*
 567968 [email protected]
 567988 [email protected]
 568009 [email protected]
 568035 [email protected]
 568064 [email protected]
 568094 [email protected]
 568124 [email protected]
 568149 [email protected]
 568177 [email protected]
 568201 [email protected]

I am getting the output version 496496 OpenSSH_7.6p1 Ubuntu-4ubuntu0.7 in client

I don't know how to edit this one, actually i am new with this environment.Can anyone please guide me to edit this.tnx

Romeo Ninov avatar
in flag
Does this answer your question? [Prevent SSH from advertising its version number](https://serverfault.com/questions/216801/prevent-ssh-from-advertising-its-version-number)
Ray Butterworth avatar
sd flag
Is there some point to listing those first three commands?
Score:3
in flag

The file /usr/sbin/sshd is binary so you can't edit it so easy. If you want to change the behavior of sshd daemon you can edit /etc/ssh/sshd_config file (and restart the daemon).

If you want to go deep and edit something inside (which do not have configuration parameter) you can get the source, edit it and compile.

About remove version number check this Q/A

Here is one Q/A how to edit the binary file directly but I will not recommend this way.

PDAVID avatar
om flag
Is it Possible to edit with dd command.I know it's complex,just asking.
Romeo Ninov avatar
in flag
@PDAVID, second link
Score:0
sy flag

I think you can use command: "sudo sed -i 's/OpenSSH_7.6p1/OpenSSH_8.4/g' /usr/sbin/sshd ; sudo service sshd restart" to change the version and restart sshd serveice to make it effctive. also, suggest to backup sshd file before file edit.

raj avatar
ye flag
raj
One should never use commands like `sed` to edit binary files. Moreover, one should never replace a string in binary file with a different length string ("OpenSSH_7.6p1" is two characters longer than "OpenSSH_8.4"), as this will most probably damage the code and stop the file from working.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.