bash SSH 远程命令仅挂在我的用户身上
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24571948/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SSH remote command hangs only on my user
提问by Elangovan Manickam
In my linux machine I'm able to do ssh to the same machine.
在我的 linux 机器上,我可以对同一台机器执行 ssh。
[myuser ~]$ssh localhost
Last login: Fri Jul 4 09:59:57 2014 from xxxx
[myuser ~]$
But when I try to run a simple remote command on the same machine using ssh, it hangs/stuck and not returning the control and no output. The command I'm trying to run is
但是当我尝试使用 ssh 在同一台机器上运行一个简单的远程命令时,它挂起/卡住并且不返回控制并且没有输出。我试图运行的命令是
[myuser ~]$ ssh localhost date
The same ssh works if I try from another user from the same machine
如果我从同一台机器上的另一个用户尝试相同的 ssh
[anotheruser ~]$ ssh localhot date
anotheruser@localhost's password:
Fri Jul 4 10:00:39 UTC 2014
[anotheruser ~]$
I have seen other threads for this problem i.e. ssh hanging, But they are different. Please let me know how can I get rid of this. Is this user privileges/groups related issue or something else?
我已经看到了针对此问题的其他线程,即 ssh 挂起,但它们是不同的。请让我知道我怎样才能摆脱这个。这是用户权限/组相关的问题还是其他问题?
I would like to have the solution as not to modify/add some flags, so this can be resolved. The above is used in some script file and I cant really afford to change that line. Since it is working another user , there should be someway to fix it.
我希望有不修改/添加一些标志的解决方案,所以这可以解决。以上用于一些脚本文件,我真的不能改变那一行。由于它正在为另一个用户工作,因此应该有办法解决它。
Please help.
请帮忙。
采纳答案by Elangovan Manickam
My problem Resolved !!! Thanks for @Aaron for helping me in debugging it.
我的问题解决了!!!感谢@Aaron 帮助我调试它。
I was going through this linkand found that exec
line from login profile making such issue each time when I do ssh.
我正在浏览此链接,发现exec
每次执行 ssh 时,登录配置文件中的那行都会产生此类问题。
From .cshrc
file I removed the following line. That solved my problem.
.cshrc
我从文件中删除了以下行。那解决了我的问题。
exec bash
Thanks for everyone showing interest to solve this issue.
感谢大家对解决这个问题表现出兴趣。
回答by Aaron Digulla
This indicates that there is a problem with making the SSH connection. Run the commands with -v
to see what SSH does behind right before it hangs.
这表明建立 SSH 连接有问题。运行命令-v
以查看 SSH 在挂起之前做了什么。
Do it with the working account to see what it would look like if it succeeds.
使用工作帐户执行此操作,看看如果成功会是什么样子。
Repeat the option to see more (i.e. -v -v -v -v
will give you almost every bit that is exchanged).
重复该选项以查看更多(即-v -v -v -v
几乎所有交换的位都会给您)。