【解决方案】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一例
112 0
|
索引
问题复盘:Kibana did not load properly. Check the server output for more information
问题复盘:Kibana did not load properly. Check the server output for more information
483 0
问题复盘:Kibana did not load properly. Check the server output for more information
|
C语言
[Error] ‘for‘ loop initial declarations are only allowed in C99 or C11 mode 解决方法
[Error] ‘for’ loop initial declarations are only allowed in C99 or C11 mode [Note] use option -std=c99,-std=gnu99,-std=c11 or-std=gnu11 to compile your code
1576 0
[Error] ‘for‘ loop initial declarations are only allowed in C99 or C11 mode 解决方法
‘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?
617 0
‘Client‘ is not allowed to run in parallel.Would you like to stop the running one?
|
安全 iOS开发 MacOS
“XXXXX” is damaged and can’t be opened. You should move it to the Trash 解决方案
“XXXXX” is damaged and can’t be opened. You should move it to the Trash 解决方案
661 0
|
SQL 数据库管理 关系型数据库
SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
测试环境:OEL6.5+Oracle 11g R2在进行执行计划测试的时候,遇到一个小问题。在用普通用户执行下面这条命令的时候,普通用户名为hhu,已经赋予了create session和resource权限。
1144 1
check_user_createdate.sh
在前面这篇文章Linux如何找出用户的创建时间里面讨论了查看用户创建时间的方法,后面自己尝试弄了一个脚本来检查所有用户创建时间脚本,当然更合理的应该叫检查所有用户的密码修改时间比较准确(因为这种方法有条件限制),期间和夕照讨论了一下如何用shell脚本实现,获益良多。
658 0
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不足导致
4174 0
|
数据安全/隐私保护
Give root password for maintenance(or type control -D to continue)
2017-09-30 18:12:08 1:错误如图,本来开机准备用一下虚拟机,就出现一个这,为啥记录一下呢,因为网上好多不是很靠谱。 原因可能是之前关闭虚拟机的时候不小心出现异常了: 2:解决办法:   个人根据自己的磁盘分区情况,进行修复即可; 解决方法,在鼠标停留的地方输入...
1866 0