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


目录
相关文章
|
4月前
|
Linux 开发工具
You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofi
linux配置环境变量操作失误出现:/usr/libexec/grepconf.sh: line 5: grep: command not found 的解决办法
138 2
|
5月前
No rule to make target ‘.xxxxxxxx‘, needed by ‘debug/xxxx.cpp‘. Stop.
No rule to make target ‘.xxxxxxxx‘, needed by ‘debug/xxxx.cpp‘. Stop.
|
索引
问题复盘:Kibana did not load properly. Check the server output for more information
问题复盘:Kibana did not load properly. Check the server output for more information
426 0
问题复盘:Kibana did not load properly. Check the server output for more information
autoreconf: command not found
autoreconf: command not found
430 0
g++: command not found
g++: command not found
81 0
That command depends on command in Target 'XXX': script phase “[CP] Copy Pods Resourc 报错解决方法
That command depends on command in Target 'XXX': script phase “[CP] Copy Pods Resourc 报错解决方法
178 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.
6317 0