Let me ask you this, why does ssh when you connect to a server for the first time ask whether you trust the host then adds that servers info to your known hosts?

|
cryptodanvr 2022-08-07 03:57:33
I’d recommend using sftp over ssh
Fibonakki 2022-08-07 03:59:19
cryptodanvr 2022-08-07 03:56:52
You need credentials first

Yes that’s for the server to know who you are. Not for you to prove the the server’s authenticity

cryptodanvr 2022-08-07 04:00:57
A hacker would need the /etc/shadow if your server
Fibonakki 2022-08-07 04:04:57
The hacker would need to intercept your initial call to the ssh server you are trying to connect to, then put his own ssh in between and let you connect there as yourself. Given that he has your public key. Which based on the name is not super hard to get)
Fibonakki 2022-08-07 04:05:47
Same way that say ssl tls works. When you go to Facebook.com without tls and certs there is no way to know that you are really on Facebook
Fibonakki 2022-08-07 04:07:39
Fibonakki 2022-08-07 04:04:57
The hacker would need to intercept your initial call to the ssh server you are trying to connect to, then put his own ssh in between and let you connect there as yourself. Given that he has your public key. Which based on the name is not super hard to get)

He doesn’t even need your public key, i guess but anyways maybe I’m talking nonsense))

cryptodanvr 2022-08-07 04:08:33
Fibonakki 2022-08-07 04:04:57
The hacker would need to intercept your initial call to the ssh server you are trying to connect to, then put his own ssh in between and let you connect there as yourself. Given that he has your public key. Which based on the name is not super hard to get)

Again the whole transaction is secure the initial connection is the key exchange

cryptodanvr 2022-08-07 04:09:01
And the /etc/shadow file is crucial
cryptodanvr 2022-08-07 04:09:48
To copy over you need a local account on the box you are connecting to
cryptodanvr 2022-08-07 04:13:03
And to capture tge ssl/tls traffic to decrypt get both keys you’d need quick timing it’s a bit more difficult and if the hacker doesn’t have your hashed password it won’t work
Fibonakki 2022-08-07 04:18:14
cryptodanvr 2022-08-07 04:09:48
To copy over you need a local account on the box you are connecting to

I can create a local account for you on the fly with whatever account you are connecting and pretend that you are on your home directory in the server you think you should be on

cryptodanvr 2022-08-07 04:18:59
No you cant
cryptodanvr 2022-08-07 04:19:22
You would need my password
Fibonakki 2022-08-07 04:22:14
I disagree. let me ask you this, why does ssh when you connect to a server for the first time ask whether you trust the host then adds that servers info to your known hosts?)
cryptodanvr 2022-08-07 04:22:37
Because it generates a key
cryptodanvr 2022-08-07 04:23:02
You would still need my password from the other server
cryptodanvr 2022-08-07 04:23:46
And you’d need to delete the local hosts file on my machine fir your idea to work
Fibonakki 2022-08-07 04:24:14
cryptodanvr 2022-08-07 04:22:37
Because it generates a key

What do you mean?

cryptodanvr 2022-08-07 04:24:37
A trust between you and the remote server
Fibonakki 2022-08-07 04:24:42
I’m specifically asking why it prompts you whether you trust the server or not
Fibonakki 2022-08-07 04:24:55
If you are trying to connect then obviously you trust it
Fibonakki 2022-08-07 04:25:06
And who would put no I don’t trust this
Fibonakki 2022-08-07 04:25:46
Everyone just presses enter)
cryptodanvr 2022-08-07 04:25:48
But if you connect to a server copying yours the known hosts file wouldn’t let you connevt
Fibonakki 2022-08-07 04:26:42
Nope. Because you say you trust it. This is deep dude
ryder_099 2022-08-07 04:26:47
cryptodanvr 2022-08-07 04:25:48
But if you connect to a server copying yours the known hosts file wouldn’t let you connevt

For the initial connection it can’t save you.

Fibonakki 2022-08-07 04:27:04
ryder_099 2022-08-07 04:26:47
For the initial connection it can’t save you.

Yep and even afterwards the hacker can still try

Fibonakki 2022-08-07 04:27:16
Because let’s say you correctly connected to smth
Fibonakki 2022-08-07 04:27:25
But then he puts an ssh server in between.
cryptodanvr 2022-08-07 04:27:41
Fibonakki 2022-08-07 04:26:42
Nope. Because you say you trust it. This is deep dude

Yes install a server then reinstall keep your sane ip and known hosts file and you’ll get an error

Fibonakki 2022-08-07 04:27:45
It will prompt you if you trust it again. And you might by default click enter and not notice
cryptodanvr 2022-08-07 04:28:27
Have a read https://stackoverflow.com/questions/20840012/ssh-remote-host-identification-has-changed

ssh remote host identification has changedStack Overflow
I’ve reinstalled my server and I am getting these messages:

[user@hostname ~]$ ssh root@pong
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS

cryptodanvr 2022-08-07 04:29:43
In order to connect you’d need to delete the entry in the known_host file because they don’t match.
Fibonakki 2022-08-07 04:29:48
cryptodanvr 2022-08-07 04:28:27
Have a read https://stackoverflow.com/questions/20840012/ssh-remote-host-identification-has-changed

This is better ofc. But again as Ryder said this is not for the very first time

Fibonakki 2022-08-07 04:30:02
Which is why ssh puts the trust on you. And asks if you trust the server
|