Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    How to automatically source bashrc over ssh?


    I am using ssh with rsa key (no password) to login to a remote computer.

    How do I get the remote shell to source the remote ~/.bashrc file automatically after ssh?

    At the moment, after I ssh, I have to run "bash" explicitly.
    All I want to do is have a remote directory added to my remote path automatically after ssh. I have tried adding the PATH command in ~/.bashrc, ~/.bash_profile, and ~/.bash_login, but none of these are sourced after ssh. Only after I type the command "bash" is the directory added to the path.
    Thanks.

  2. #2
    Linux Engineer Javasnob's Avatar
    Join Date
    Jul 2005
    Location
    Wisconsin
    Posts
    942
    Are you sure your default shell is bash? Try echo $SHELL. If so, it should source .bash_profile by default.
    Flies of a particular kind, i.e. time-flies, are fond of an arrow.

    Registered Linux User #408794

  3. #3

    echo $SHELL gives /bin/tcsh

    Apparently the default shell is tcsh.
    Which file should I edit so that ssh goes to a bash shell instead of the default tcsh shell?
    (I have no system privileges.)

  4. $spacer_open
    $spacer_close
  5. #4

    Problem Solved

    I created a ~/.tcshrc file with the script to add the directory to the path.
    That works.
    Thanks for the lead about the different default shell.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •