大网数据广告活动
服务器运维问答

SSH hangs on login after 'last update'

· 52CE 我爱测

I'm having a bit of trouble. My SSH connection hangs for about 10 seconds when logging in. I've tried disabling the system info MOTD and a number of other things but it just doesn't seem to work. Trying ssh user@host -vvv doesn't…

问题原文

原帖链接 · andy · CC BY-SA 3.0

I'm having a bit of trouble. My SSH connection hangs for about 10 seconds when logging in. I've tried disabling the system info MOTD and a number of other things but it just doesn't seem to work. Trying ssh user@host -vvv doesn't help either as the log ends before the hang. It just says:

Last login: Wed Apr 17 12:52:04 2013 from 194.xx.xx.xx

Then hangs for a few seconds until it displays the prompt (user@host $) One interesting thing to note: If I press ctrl+c during this hang, it immediately solves it and the prompt flashes up so I'm guessing it's a process that is hanging. What's the best way to fix this?

已采纳解答

原帖链接 · Jenny D · CC BY-SA 4.0

This is usually because one of the files used by login has some function that takes a long time to return. It will commonly be either in your own home directory, where you should look at

 .profile
 .bashrc
 .login
 .kshrc
 .tcshrc

If it's none of those, look in /etc for the same files, but usually without the dot:

/etc/profile
/etc/bashrc

and so on. The culprit will often be something that does a DNS lookup, but it might also be that you have it set to check when you last logged on, and your utmp/wtmp/btmp is very large.

ls -lhS /var/log/

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2013-04-17)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。