LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 07-14-2009, 03:06 AM   #1
cov
Member
 
Registered: Apr 2005
Location: Durban
Posts: 363

Rep: Reputation: 30
Delay before password prompt over ssh.


When I ssh into my new Debian box there is a wait of some 15 seconds before the password prompt comes up.

This is a minor irritation, but is a bit annoying, because quite often I go to some other task and when I come back the ssh session has reset and I have to start over.

I read somewhere that it's caused by DNS issues and I should edit my /etc/hosts file but my router is allocating DHCP.

Can anyone suggest a fix?

Also my ftp is slow, and I'm thinking it's the same underlying cause.
 
Old 07-14-2009, 03:18 AM   #2
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by cov View Post
When I ssh into my new Debian box there is a wait of some 15 seconds before the password prompt comes up.

This is a minor irritation, but is a bit annoying, because quite often I go to some other task and when I come back the ssh session has reset and I have to start over.

I read somewhere that it's caused by DNS issues and I should edit my /etc/hosts file but my router is allocating DHCP.

Can anyone suggest a fix?

Also my ftp is slow, and I'm thinking it's the same underlying cause.
change

Code:
#UseDNS yes

to

Code:
UseDNS no
in the sshd config file
 
Old 07-14-2009, 04:49 AM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
well as you said, it's very likely to be a DNS issue. on the destination server run "host ip.of.cli.ent" and that's what sshd is also doing when you connect. you can turn off dns resolution in your /etc/ssh/sshd_config or make it resolve to a valid host name however you see fit.
 
Old 07-14-2009, 05:50 AM   #4
cov
Member
 
Registered: Apr 2005
Location: Durban
Posts: 363

Original Poster
Rep: Reputation: 30
Thank you, guys.

I have set the IP in my /etc/hosts and it's made a big difference.

Dunno what'll happen if the DHCP doesn't allocate the same IP, though.
 
Old 07-14-2009, 06:40 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
Well it probably will, if there's not a compelling reason to provide a different IP, you can usually rely on the same one. Or maybe you can reserve one on the the DHCP server?
 
Old 07-14-2009, 07:25 AM   #6
akiku
Member
 
Registered: Jun 2009
Distribution: Slackware
Posts: 62

Rep: Reputation: 17
Quote:
Originally Posted by cov View Post
This is a minor irritation, but is a bit annoying, because quite often I go to some other task and when I come back the ssh session has reset and I have to start over.
Are you familiar with autossh?
Sounds like you solved your login delay problem, but this can save you from having to start over.
 
Old 07-14-2009, 08:08 AM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
Quote:
Originally Posted by akiku View Post
Are you familiar with autossh?
Sounds like you solved your login delay problem, but this can save you from having to start over.
If you're going between proper Linux systems, why bother? What would this give you other than preshared keys and a while [ 1 ] loop??
 
Old 07-15-2009, 02:15 AM   #8
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by cov View Post
Thank you, guys.

I have set the IP in my /etc/hosts and it's made a big difference.

Dunno what'll happen if the DHCP doesn't allocate the same IP, though.
set the 'UseDNS' option to no in sshd config file
 
Old 07-15-2009, 11:52 AM   #9
akiku
Member
 
Registered: Jun 2009
Distribution: Slackware
Posts: 62

Rep: Reputation: 17
Quote:
Originally Posted by acid_kewpie View Post
If you're going between proper Linux systems, why bother? What would this give you other than preshared keys and a while [ 1 ] loop??
It would give you a perpetual ssh session that does not require user intervention. autossh monitors the connection and automatically reconnect if the remote sshd or local ssh client die for any reason.
I thought this was exactly what you asked for originally.
 
Old 07-15-2009, 11:57 AM   #10
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 206Reputation: 206Reputation: 206
Avoid the password prompt all together!: http://www.cs.umd.edu/~arun/misc/ssh.html
 
Old 07-15-2009, 12:03 PM   #11
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
But the question has nothing to do with passwords...??
 
Old 07-16-2009, 06:40 AM   #12
akiku
Member
 
Registered: Jun 2009
Distribution: Slackware
Posts: 62

Rep: Reputation: 17
Quote:
Originally Posted by cov View Post
When I ssh into my new Debian box there is a wait of some 15 seconds before the password prompt comes up.

This is a minor irritation, but is a bit annoying, because quite often I go to some other task and when I come back the ssh session has reset and I have to start over.
Original question (above) has to do with having to enter a password to reconnect via ssh, no? OP does not explain why the ssh is "reset" and that would require a different approach to correct, but, regardless, whatever the reason ssh dies, autossh will reestablish the connection automatically w/o the need to login again.
It "fixes" the original issue.
 
Old 07-16-2009, 06:48 AM   #13
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
No, the issue is the delay. that's the point. nothing about passwords, nothing about losing connection even really. whether the delay is followed by a password or a direct login, the delay is still going to be there. autossh doesn't fix the issue it hacks around it.
 
Old 07-16-2009, 10:30 AM   #14
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 206Reputation: 206Reputation: 206
Truth be told, I've had to deal with this in the past, too. I just wrote it off as that I had a poor (thin pipe) Internet connection and the problem went away when I moved to a better network.

Is UseDNS No helping you out, cov? I've not tried it ever.
 
Old 07-16-2009, 01:53 PM   #15
akiku
Member
 
Registered: Jun 2009
Distribution: Slackware
Posts: 62

Rep: Reputation: 17
I guess we beat this password vs reconnect thing to death, acid_kewpie?
Two problems, I suppose -- (1) annoying delay for password prompt and (2) having to login again after ssh connection dies (irritating in itself but specially so because of the long password delay).
cov seems to be happy with a solution for problem (1) -- see post #4.
My suggestion deals with problem (2).

So in the end, no delays to login, no need to reconnect and everybody is happy.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] problem adding ssh keys to skip password prompt vikas027 Linux - Software 27 09-26-2008 03:24 PM
ssh no password prompt dtra Linux - Software 9 05-25-2005 01:08 PM
ssh password prompt delay long while chaze Linux - Networking 1 04-14-2005 10:03 PM
ssh without the password prompt markehb Linux - Networking 27 03-25-2004 11:12 AM
remote command over ssh, password prompt linowes Linux - General 2 10-27-2002 08:22 PM


All times are GMT -5. The time now is 01:20 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration