glen writes: Hi Jacky, > It hangs after tramp-send-command(), tramp-wait-for-output(). > It seems that the emacs-tramp can't detect the output of remote command. > > See the attached file for more details. > > Any ideas? Your shell prompt doesn't look Tramp affin, there are escape sequences: > 18:10:54.192196 tramp-send-command (6) # exec ssh -l jacky -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none 192.168.98.76 > 18:10:59.920689 tramp-process-actions (6) # > Password: > Last login: Fri Jun 16 18:08:04 2017 from 192.18.8.8 > [?1034hCopyright(c) 2005-2011, QiZhi Technologies. All Rights Reserved. > License granted to Hze Co., Ltd, from 2015-03-09 to 2037-12-31. > > > Selected group: linshi > > Selected server: 72.2.96.9 (72.2.96.9) > > Selected account: root > > ]0;root@72.2.96.9 - SHTERM > SHTERM 2.6.3-35fa58f3 > Copyright (c) 2005-2011, QiZhi Technologies. All Rights Reserved. > License granted to Hze Co., Ltd. > Valid from 2015-03-09 to 2037-12-31. > Last login: Fri Jun 16 18:08:08 2017 from 172.22.215.224 > ]0;root@WINDANCER:~[?1034h[root@WINDANCER ~]# The login has worked successfully, despite the escape sequences. > 18:10:59.923488 tramp-send-command (6) # exec env TERM='xterm' ENV='' HISTFILE=~/.tramp_history PROMPT_COMMAND='' PS1=\#\$\ PS2='' PS3='' /bin/sh > 18:12:24.347680 tramp-open-shell (5) # Opening remote shell €˜/bin/sh€™...failed This command has failed. Even no output in the buffer. I recommend to suppress the escape sequences in your shell prompt, see the Tramp manual for hints how to do this. > PS: what's meaning of regex: "[^#$\n]*%s\r?$"? It's part of the `format' clause to determine the shell prompt; %s is replaced by the value of `tramp-end-of-output'. In your case, this variable should be "#$ ". Later on, once the connection has been established, `tramp-end-of-output' is a random string like "///e90c02f62ec0d7a2f6da0b67a20f8264#$". > Jacky Wang Best regards, Michael.