Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In my ~/.bashrc I have environment variables definition similar to

export LC_CTYPE="es_ES.UTF-8"

when I use a ssh connection some of this variables have problems in the remote computer

man: can't set the locale; make sure $LC_* and $LANG are correct

how I can unset some variables when I start a ssh connection and restore when I close the connection.

share|improve this question

1 Answer 1

ssh doesn't copy your local environment to the remote machine. See the ENVIRONMENT section of the ssh man page for details. In short, there is a small list of variables that are set in the remote session, and you can put additional variables in ~/.ssh/environment. Note that the ability to set the environment on the remote end from the local machine needs to be enabled in the remote sshd process via the PermitUserEnvironment configuration option.

Alternatively, you need to set the values you need on the remote machine in your .bashrc file on the remote machine.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.