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.

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 stackoverflow.com Oct 12 '11 at 12:28

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

3 Answers 3

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.

Caveats:

  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

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.