Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .