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

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

问题描述

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

Possible Duplicate:
Why does an SSH remote command get fewer environment variables then when run manually?

如果我输入命令

ssh用户@ $ IP蚂蚁

ssh user@$IP ant

然后我收到

bash:ant:找不到命令

bash: ant: command not found

但是当我登录

ssh用户@ $ IP

ssh user@$IP

放入

ant

ant

然后工作正常.

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天全站免登陆