【解决方案】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即可。


目录
相关文章
|
索引
问题复盘:Kibana did not load properly. Check the server output for more information
问题复盘:Kibana did not load properly. Check the server output for more information
507 0
问题复盘:Kibana did not load properly. Check the server output for more information
运行 ‘ApiApplication‘ 出错: Command line is too long. Shorten command line for ShopApiApplication or
运行 ‘ApiApplication‘ 出错: Command line is too long. Shorten command line for ShopApiApplication or
263 0
运行 ‘ApiApplication‘ 出错: Command line is too long. Shorten command line for ShopApiApplication or
‘Client‘ is not allowed to run in parallel.Would you like to stop the running one?
‘Client‘ is not allowed to run in parallel.Would you like to stop the running one?
626 0
‘Client‘ is not allowed to run in parallel.Would you like to stop the running one?
Error running 'XXXApplication': Command line is too long. Shorten command line forXXX
Error running 'XXXApplication': Command line is too long. Shorten command line forXXX
177 0
Error running 'XXXApplication': Command line is too long. Shorten command line forXXX
check_user_createdate.sh
在前面这篇文章Linux如何找出用户的创建时间里面讨论了查看用户创建时间的方法,后面自己尝试弄了一个脚本来检查所有用户创建时间脚本,当然更合理的应该叫检查所有用户的密码修改时间比较准确(因为这种方法有条件限制),期间和夕照讨论了一下如何用shell脚本实现,获益良多。
664 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.
6395 0