ssh can't connect using hostname
run
ping git.stvns.com
Are you see 192.168.1.2 ip?
I think you havenot problem with ssh, you have problem with dns.
What dns server are you use? (cat /etc/resolv.conf )
Related videos on Youtube
Niels
Updated on September 18, 2022Comments
-
Niels over 1 year
I'm setting up some server but I stubbled into an issue with one server.
I setup a local dns server, and when I try to connect to this server with ssh [email protected] I will get : Permission denied (publickey,keyboard-interactive).
But when I access it like [email protected] it works fine with Pubkey Auth. Strange part is when I connect to a server git.stvns.com => a hostname managed by the dns server, it will connect fine when using the hostname.
I'm using a ubuntu 10.04 amd64 as base for all the server, they are actually identical images I took a snapshot from the bare minimum setup, so can't blame the OS.
I compared my sshd_config files but they are almost Identical, only the place of the authorized_keys is different, can't blame that full for giving problems.
Locally I removed my known_hosts related to the dns server and tried again without any luck.
This is a copy of my sshd_config file maybe someone spots a error:
Port 22 Protocol 2 HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_dsa_key UsePrivilegeSeparation yes LoginGraceTime 20 PermitRootLogin no RSAAuthentication yes RhostsRSAAuthentication yes HostBasedAuthentication no PubkeyAuthentication yes AuthorizedKeysFile /etc/ssh/authorized_keys PermitEmptyPasswords no PasswordAuthentication no StrictModes no ClientAliveInterval 60 ClientAliveCountMax 0 # Host Specific !!!!! ListenAddress 192.168.1.61 # List of allowed users AllowUsers alpha # Lifetime and size of ephemeral version 1 server key KeyRegenerationInterval 3600 ServerKeyBits 768 # Logging SyslogFacility AUTH LogLevel INFO X11Forwarding yes X11DisplayOffset 10 PrintMotd no PrintLastLog yes TCPKeepAlive yes #UseLogin no # Allow client to pass locale environment variables AcceptEnv LANG LC_*
Does anyone countered the same problem? Or has some advise?
Thanks a lot in advance!
-
phemmer about 12 yearsYou just set up a DNS server, and now youre saying that logging into a machine via its DNS hostname doesnt work, but via its IP does. Since you've been playing with DNS, start simple. Are you sure
alpha.stvns.com
is resolving to192.168.1.2
? -
Niels about 12 yearsYes I can dig and nslookup it no problem using resolving the hostname
-
Khaled about 12 yearsDo you have SELinux running?
-
Niels about 12 yearsNo I'm running ubuntu and as client mac os x. But I solved my issue apperently I needed to flush the dns cache on my mac with this command: dscacheutil -flushcache
-