Set environment variables on the SSH client

Source: Internet
Author: User
Tags ssh server

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.