2

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!

5
  • 4
    Use "ssh -v" and you will see why. The problem is probably into your ssh_config (not into ssd_config) or because your ~/.ssh/know_host contain a wrong value. Apr 22, 2012 at 21:43
  • 2
    You 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 to 192.168.1.2?
    – phemmer
    Apr 22, 2012 at 23:22
  • Yes I can dig and nslookup it no problem using resolving the hostname
    – Niels
    Apr 23, 2012 at 6:55
  • Do you have SELinux running?
    – Khaled
    Apr 23, 2012 at 7:32
  • No 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
    – Niels
    Apr 24, 2012 at 8:45

2 Answers 2

1

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 )

0

@Niels the issue is hostname is different on the box and DNS entry which we have or trying to ssh to is different.

Consider the example :

root@gw:~# cat /etc/hostname
gw.analytics.example.net

following keeps failing because in ssh protocol both got verified client authenticate server and vice versa.

    git:master=⚡ ssh gw.analytics.example.io -l root -i ~/.ssh/id_rsa.pub
ssh: Could not resolve hostname gw.analytics.example.io: nodename nor servname provided, or not known

Even though I have the DNS entry correct and able to resolve them manually.

    git:master=⚡ dig gw.analytics.example.io

; <<>> DiG 9.9.7-P3 <<>> gw.analytics.example.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56491
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;gw.analytics.example.io.   IN  A

;; ANSWER SECTION:
gw.analytics.example.io. 263    IN  A   10.17.71.2

;; Query time: 2 msec
;; SERVER: 192.168.254.1#53(192.168.254.1)
;; WHEN: Mon Oct 02 10:47:04 +08 2017
;; MSG SIZE  rcvd: 69

So I've changed the hostname of the box as per the DNS name I am trying to ssh.It works fine.

root@gw:~# cat /etc/hostname
gw.analytics.example.io

and I am able to login

git:master=⚡ ssh gw.analytics.example.io -l root -i ~/.ssh/id_rsa.pub
root@gw:~# hostname
gw.analytics.example.io
root@gw:~# uptime
 03:13:59 up 46 min,  2 users,  load average: 0.39, 0.49, 0.35
root@gw:~#

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .