When using the SSH client, you will find that the environment variables you set are not easy to use and some commands cannot be executed. The specific solution is:
1. Confirm the version of the SSH server.
$ Telnet localhost 22
SSH-2.0-OpenSSH_4.3
Check that the version is openssh_4.3.
2. Enable OpenSSH to accept client environment variable settings
Method 1:
A. Set the server
Root modify the/etc/ssh/sshd_config file and add
# The Server accepts Environment Variables
Acceptenv ORACLE_HOME
B. Restart the service.
# Service sshd restart
C. set to allow the client to pass its environment variables to the server.
Root modify the/etc/ssh/sshd_config file and add
Sendenv ORACLE_HOME
D. Note that the client variable needs to be export.
Method 2:
A. Set the server
Root modify the/etc/ssh/sshd_config file and add
# Allow the use of user environment variables
Permituserenvironment Yes
B. Restart the service.
# Service sshd restart
C. Create an environment file for the user
$ Mkdir ~ /. Ssh/
$ Gedit Environment
Write environment variable content
D. $ chmod 600 ~ /. Ssh/Environment
Summary:
The difference between method 2 and method 1 is that method 1 sets the environment variables on the client, and method 2 sets the variables on the server and is automatically obtained upon logon.