2

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.

3 Answers 3

5

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

5

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
1

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.

You must log in to answer this question.

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