【解决方案】A session ended very soon after starting. Check that the command in profile “XXX” is correct.

简介: 【解决方案】A session ended very soon after starting. Check that the command in profile “XXX” is correct.

1.背景

今天使用iTerm工具远程连接SSH时遇到Warning警告⚠️提示“A session ended very soon after starting. Check that the command in profile “XXX” is correct.”


如下图所示:

b8244229e81195befb0eaee5974d0337_ea480f8441e44685ba0c86816c699456.png


2.解决方案

2.1.打开iTerm2的偏好设置

操作步骤:从左上角iTerm2下拉菜单找到偏好设置:iTerm2->Preferences,如下图所示:

07a7101ea5a3215843609cdb443244cb_40e451d9a6b24d00a59fceda4860af88.png


2.2.查看ssh配置的远程服务器配置文件路径地址

找到Profiles->远程地址->Command的地址,如下图所示:

12a5e7abae8118ae6a54d62af70c3f1d_2a12b893334a4a4d91d94b80f1e89830.png


2.3.查看文件是否存在

iTerm2中ssh配置的远程服务器配置文件路径地址要与Command里填的地址一致,不一致时会报“A session ended very soon after starting. Check that the command in profile “XXX” is correct.”错误。


使用cat命令检测文件内容:

cat ~/.ssh/XXXXXGPU-XXXX  # 若输出了文件内容,说明路径正确。

9a536e9c83450e17b900dff21fa4cddd_0a4c15e0bf184d4d855055d622d3eb84.png

2.4.若文件存在,则需要重置known_hosts

查找known_hosts位置,使用vim进入修改内容。

vim ~/.ssh/known_hosts 

85da786051e62c204c3080b44548dd0e_bc623b552603438aa8b92714c0d00608.png

正常的格式,known_hosts文件的内容是一个IP地址,后面紧跟着保存的密钥串,一行一个。重置时,需要将对应的IP地址内容删除,然后保存退出。

例如:想远程ssh登录a.b.c.d这个地址但报“A session ended very soon after starting. Check that the command in profile “XXX” is correct.”错误,那就把known_hosts文件里a.b.c.d这一行记录全部删除,然后保存文件退出。


2.5.重新启动iTerm2,建立ssh连接

重启iTerm2连接ssh即可。


目录
相关文章
|
数据库
11g health monitor新特性 DBMS_HM.RUN_CHECK
11g health monitor新特性,DBMS_HM.RUN_CHECK一例
|
网络协议
Job for named.service failed because the control process exited with error code.
Job for named.service failed because the control process exited with error code.
638 0
|
NoSQL MongoDB 数据安全/隐私保护
OCI runtime exec failed: exec failed: unable to start container process: exec: "mongo": executable file not found in $PATH: unknown
OCI runtime exec failed: exec failed: unable to start container process: exec: "mongo": executable file not found in $PATH: unknown
1007 0
OCI runtime exec failed: exec failed: unable to start container process: exec: "mongo": executable file not found in $PATH: unknown
|
网络协议
Job for named.service failed because the control process exited with error code.怎么解决
本篇内容记录了如何解决Job for named.service failed because the control process exited with error code.的问题。
3296 0
Job for named.service failed because the control process exited with error code.怎么解决
Starting a Gradle Daemon, 5 busy and 1 incompatible and 1 stopped Daemons could not be reused, use --status for details FAILURE: Build failed with an
执行gradle build出的问题,查看hs_err_pid11064.log日志文件发现,是电脑的RAM不足导致
4019 0
|
网络协议 Java 容器
【报错】项目启动,仅仅报错 One or more listeners failed to start. Full details will be found in the appropriate container log file
今天spring4.3.13 项目,整合ActiveMQ的时候,项目启动在自动部署到tomcat下的时候,不能正常的部署,仅仅报错如下: Connected to server [2017-12-08 03:57:12,428] Artifact springDemo:war exploded: Artifact is being deployed, please wait.
6204 0
|
Android开发 Go
Gradle sync failed: The first result from the daemon was empty. Most likely the process died immediately after connection
Gradle sync failed: The first result from the daemon was empty. Most likely the process died immediately after connection solv...
2926 0