错误 -bash:ssh 用户名@server -i:未找到命令

错误 -bash:ssh 用户名@server -i:未找到命令

我正在尝试从 MAC 上的终端通过 ssh 进入服务器。几天前它还可以正常工作,但今天就停止了。

当我进入ssh username@server -i .ssh/file

我明白了-bash: ssh username@server -i: command not found

whereis ssh产生 /usr/bin/ssh

echo $PATH给我一个看起来很奇怪的路径 /Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin

我尝试将 PATH 设置为 /usr/bin,export PATH=/usr/bin并且似乎设置了它,但重新启动时它会重置为上述路径。

运行时 SSH 配置sudo nano /etc/ssh/ssh_config

  GNU nano 2.0.6           File: /etc/ssh/ssh_config                            

#       $OpenBSD: ssh_config,v 1.34 2019/02/04 02:39:42 dtucker Exp $

# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information.  This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
#  1. command line options
#  2. user-specific file
#  3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for some commonly used options.  For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

最终对我有用的是以下命令: /usr/local/Cellar/openssh/8.6p1/bin/ssh username@server -i .ssh/file

相关内容