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

I have noticed that sometimes a shell account that I access over SSH inherits the aliases and file type coloring from my home shell.

How does this process occur? These shells are usually BASH but I imagine it is something which all TTY emulators have in common.

share|improve this question

migrated from Oct 12 '11 at 12:28

This question came from our site for professional and enthusiast programmers.

It has nothing to do with SSH, bash, or terminal emulators. They're just set up the same way on the other side.

share|improve this answer

Actually, you can make ssh send environment variables over to the server, so they are available in the remote session. Here's how you do it (example for file type colors, but you can adapt it for other environment variables too):

  1. In your ~/.ssh/config (current user) or /etc/ssh/ssh_config (all users) add these lines:

    Host *
    SendEnv LS_COLORS

  2. In remote server's /etc/ssh/sshd_config add this line if it does not exist:

    AcceptEnv LS_COLORS

    Note: You may need to modify the existing AcceptEnv line to just add LS_COLORS to it.

  3. Restart ssh server.

That's it! Now, your ssh session will inherit ls colors from your current shell.


  1. That this won't work with aliases, just with environment variables.
  2. Works for ssh protocol 2 only.
  3. Your remote shell may overwrite what's being sent via remote .bashrc
share|improve this answer

Like Ignacio said, it's set up that way where you're connecting. Just move your .bashrc (or whatever files you use) over and connect.

share|improve this answer

You must log in to answer this question.

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