SSH access issue

Is there any difference between ssh root@72.287.155.76 and ssh -i ~/.ssh root@72.287.155.76. Because when I do ssh root@72.287.155.76 I can access my server and when I do ssh -i ~/.ssh root@72.287.155.76. . its asking for server password.

Why it is so.

-i is an option to give a specific identity file, but ~/.ssh is usually not a file, but the directory the file is stored in.

If you do your second command, ssh does not find an identity file and falls back to password login.

1 Like

hi,
since two days Iā€™m trying to link my ssh connection with 2FA. But unfortunately im getting the error after entering the password of my user account and verification code from google AuthenticatorConnection closed by 55.555.55.55 port 22222. I followed the coin cashew guide and configured /etc/pam.d/sshd and etc/ssh/sshd_config for the setup (Hardening an Ubuntu Server - CoinCashew). I did exactly what they told but still im not able to do the 2FA. I googled a lot and found a person who had a similar issue while configuring 2FA, please see this link(debian - error: PAM: User account has expired for [user] from [IP] - Unix & Linux Stack Exchange ). Could you please help me out.