Skip to main content
rm stray single quote
Source Link
janmoesen
  • 2.7k
  • 19
  • 16

You can send along environment variables from your local machine using SSH.

For example, put export FOO_USER="$USER" (in tcsh's version of .bash_profile) or FOO_USER=joe ssh remote-host (on the command line) on your local machine. Edit your ~/.ssh/config to include this: SendEnv LANG LC_* FOO_USER.

Then, on the remote server, you can check for that variable in the .bash_profile (or what have you in tcsh), and perform the appropriate action:

if [ "$FOO_USER" = 'joe' ]; then
    export PS1='--[ Joe rules ]-- \u@\h \w \$ ';
    source tcsh.joe;
elif [ "$FOO_USER" = 'jane' ]';]; then
    alias ll='ls -Al';
fi

By default, the SSH server only accepts LANG and LC_*, so if you cannot edit /etc/ssh/sshd_config on the server to add AccceptEnv LANG LC_* FOO_USER, you could hack around it by abusing the LC_* variables, e.g. LC_FOO_USER=joe. Update your .bash_profiles (or rather, the appropriate local and remote tcsh files) accordingly.

You can send along environment variables from your local machine using SSH.

For example, put export FOO_USER="$USER" (in tcsh's version of .bash_profile) or FOO_USER=joe ssh remote-host (on the command line) on your local machine. Edit your ~/.ssh/config to include this: SendEnv LANG LC_* FOO_USER.

Then, on the remote server, you can check for that variable in the .bash_profile (or what have you in tcsh), and perform the appropriate action:

if [ "$FOO_USER" = 'joe' ]; then
    export PS1='--[ Joe rules ]-- \u@\h \w \$ ';
    source tcsh.joe;
elif [ "$FOO_USER" = 'jane' ]'; then
    alias ll='ls -Al';
fi

By default, the SSH server only accepts LANG and LC_*, so if you cannot edit /etc/ssh/sshd_config on the server to add AccceptEnv LANG LC_* FOO_USER, you could hack around it by abusing the LC_* variables, e.g. LC_FOO_USER=joe. Update your .bash_profiles (or rather, the appropriate local and remote tcsh files) accordingly.

You can send along environment variables from your local machine using SSH.

For example, put export FOO_USER="$USER" (in tcsh's version of .bash_profile) or FOO_USER=joe ssh remote-host (on the command line) on your local machine. Edit your ~/.ssh/config to include this: SendEnv LANG LC_* FOO_USER.

Then, on the remote server, you can check for that variable in the .bash_profile (or what have you in tcsh), and perform the appropriate action:

if [ "$FOO_USER" = 'joe' ]; then
    export PS1='--[ Joe rules ]-- \u@\h \w \$ ';
    source tcsh.joe;
elif [ "$FOO_USER" = 'jane' ]; then
    alias ll='ls -Al';
fi

By default, the SSH server only accepts LANG and LC_*, so if you cannot edit /etc/ssh/sshd_config on the server to add AccceptEnv LANG LC_* FOO_USER, you could hack around it by abusing the LC_* variables, e.g. LC_FOO_USER=joe. Update your .bash_profiles (or rather, the appropriate local and remote tcsh files) accordingly.

tcsh notes
Source Link
janmoesen
  • 2.7k
  • 19
  • 16

You can send along environment variables from your local machine using SSH.

For example, put export FOO_USER="$USER" (in yourtcsh's version of .bash_profile) or FOO_USER=joe ssh remote-host (on the command line) on your local machine. Edit your ~/.ssh/config to include this: SendEnv LANG LC_* FOO_USER.

Then, on the remote server, you can check for that variable in the .bash_profile (or what have you in tcsh), and perform the appropriate action:

if [ "$FOO_USER" = 'joe' ]; then
    export PS1='--[ Joe rules ]-- \u@\h \w \$ ';
    source tcsh.joe;
elif [ "$FOO_USER" = 'jane' ]'; then
    alias ll='ls -Al';
fi

By default, the SSH server only accepts LANG and LC_*, so if you cannot edit /etc/ssh/sshd_config on the server to add AccceptEnv LANG LC_* FOO_USER, you could hack around it by abusing the LC_* variables, e.g. LC_FOO_USER=joe. Update your .bash_profiles (or rather, the appropriate local and remote tcsh files) accordingly.

You can send along environment variables from your local machine using SSH.

For example, put export FOO_USER="$USER" (in your .bash_profile) or FOO_USER=joe ssh remote-host (on the command line) on your local machine. Edit your ~/.ssh/config to include this: SendEnv LANG LC_* FOO_USER.

Then, on the remote server, you can check for that variable in the .bash_profile (or what have you), and perform the appropriate action:

if [ "$FOO_USER" = 'joe' ]; then
    export PS1='--[ Joe rules ]-- \u@\h \w \$ ';
elif [ "$FOO_USER" = 'jane' ]'; then
    alias ll='ls -Al';
fi

By default, the SSH server only accepts LANG and LC_*, so if you cannot edit /etc/ssh/sshd_config on the server to add AccceptEnv LANG LC_* FOO_USER, you could hack around it by abusing the LC_* variables, e.g. LC_FOO_USER=joe. Update your .bash_profiles accordingly.

You can send along environment variables from your local machine using SSH.

For example, put export FOO_USER="$USER" (in tcsh's version of .bash_profile) or FOO_USER=joe ssh remote-host (on the command line) on your local machine. Edit your ~/.ssh/config to include this: SendEnv LANG LC_* FOO_USER.

Then, on the remote server, you can check for that variable in the .bash_profile (or what have you in tcsh), and perform the appropriate action:

if [ "$FOO_USER" = 'joe' ]; then
    export PS1='--[ Joe rules ]-- \u@\h \w \$ ';
    source tcsh.joe;
elif [ "$FOO_USER" = 'jane' ]'; then
    alias ll='ls -Al';
fi

By default, the SSH server only accepts LANG and LC_*, so if you cannot edit /etc/ssh/sshd_config on the server to add AccceptEnv LANG LC_* FOO_USER, you could hack around it by abusing the LC_* variables, e.g. LC_FOO_USER=joe. Update your .bash_profiles (or rather, the appropriate local and remote tcsh files) accordingly.

Source Link
janmoesen
  • 2.7k
  • 19
  • 16

You can send along environment variables from your local machine using SSH.

For example, put export FOO_USER="$USER" (in your .bash_profile) or FOO_USER=joe ssh remote-host (on the command line) on your local machine. Edit your ~/.ssh/config to include this: SendEnv LANG LC_* FOO_USER.

Then, on the remote server, you can check for that variable in the .bash_profile (or what have you), and perform the appropriate action:

if [ "$FOO_USER" = 'joe' ]; then
    export PS1='--[ Joe rules ]-- \u@\h \w \$ ';
elif [ "$FOO_USER" = 'jane' ]'; then
    alias ll='ls -Al';
fi

By default, the SSH server only accepts LANG and LC_*, so if you cannot edit /etc/ssh/sshd_config on the server to add AccceptEnv LANG LC_* FOO_USER, you could hack around it by abusing the LC_* variables, e.g. LC_FOO_USER=joe. Update your .bash_profiles accordingly.