English 中文(简体)
环境变数
原标题:ssh environment variable bash command not found

我试图从Ssh 非互动ssh接线开始指挥。 为此,我使用了斜线连接。

In order to set everything up I used this article: http://www.raphink.info/2008/09/forcing-environment-in-ssh.html

I use ~/.ssh/environment. In order to do that, I set PermitUserEnvironment to "yes" in sshd_config and restarted sshd.

在我身上 我有以下内容:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/ubuntu/java/jdk1.6.0_27/bin

JAVA_HOME=/home/ubuntu/java/jdk1.6.0_27

#PATH=/home/ubuntu/java/jdk1.6.0_27/bin:$PATH

#PLAY_HOME=/home/ubuntu/play

在试图利用非互动联系时,我有错误:

 [sshexec] Could not execute the java executable, please make sure the JAVA_HOME environment variable is set properly (the java executable should reside at JAVA_HOME/bin/java). 

但我又走了这条路。

最佳回答

<代码>sshd(8)的男子页称:~/ssh/environment:

    It can only contain empty lines, comment lines (that start with
    ‘#’), and assignment lines of the form name=value.

也就是说,这并非是一纸空文。 你们有双重引用、可变的扩展和别的界定。 所有这一切都不会奏效。 为此:

PATH=/home/ubuntu/java/jdk1.6.0_27/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
JAVA_HOME=/home/ubuntu/java/jdk1.6.0_27
PLAY_HOME=/home/ubuntu/play

还确保<代码>~/.ssh/environment上的许可,如上页所示——档案上没有团体或其他书面许可。

如果你担心在中断的环境下关闭账户,首先通过伐木进行测试,并像这样进行测试:

ssh localhost  echo $JAVA_HOME 

你们可以确保环境变量的设定与你所期望的环境变数相同,如果出现错误的话,你仍然被搁置到东道国,以便你扭转变化。

问题回答

您在path <>/strong>上使用了多端正表。 但从指挥中看不出出口。

You should do it like that way.

export PATH="A"
export PATH="$PATH:B"
export PATH="$PATH:C"

Also you can get this type of help from there. So please post it to unix.

https://unix.stack Exchange.com/questions/12391/how-to-run-my-c-program- from-any where-within-the-system-ubuntu-10-10

希望会有所助益。





相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...