使用单个命令通过 ssh 找不到命令,在连接到终端后找到 [英] Command not found via ssh with single command, found after connecting to terminal

查看:33
本文介绍了使用单个命令通过 ssh 找不到命令,在连接到终端后找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
为什么 SSH远程命令获得的环境变量比手动运行时少?

如果我输入命令

ssh user@$IP 蚂蚁

ssh user@$IP ant

然后我收到

bash: ant: 命令未找到

bash: ant: command not found

但是当我登录时

ssh 用户@$IP

ssh user@$IP

然后放

蚂蚁

然后工作正常.

Ant 安装在远程和本地机器上.问题出在哪里?

Ant is installed on remote and local machines. Where is the problem?

我试图在 google 中找到解决方案,但一无所获.

I've tried to find solution in google and found nothing.

预先感谢您的帮助!

--编辑--

我需要调用一些 bash 脚本,不想将所有路径更改为完整路径.

I need to invoke some bash scripts, don't want to change all paths to full path.

推荐答案

默认情况下,通过 ssh 连接时不加载配置文件.要启用此行为,请在/etc/ssh/sshd_config 中设置以下选项:

By default profiles aren't loaded when connecting via ssh. To enable this behaviour, set the following option in /etc/ssh/sshd_config:

PermitUserEnvironment yes

之后重启ssh

/etc/init.d/ssh restart

这篇关于使用单个命令通过 ssh 找不到命令,在连接到终端后找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆