6. Caveats

6.1. Set Working Directory

The initial working directory on the local machine and remote machines may be different, so it’s better to explicitly set the working directory. Two recommended options are:

  1. Use absolute paths all the time

  2. cd to a directory first and use relative paths afterwards

6.2. Set Environment Variables

You should explicitly set the environment variables to avoid unexpected errors. The two most commonly used environment variables are:

  1. PATH

  2. LD_LIBRARY_PATH

You should set them before the start of each experiment.

6.3. Choose the Type of Shells

The commands executed on remote machines will use non-interactive non-login shell by default. That means the following files won’t be used at all:

  1. /etc/profile

  2. /etc/bash.bash_logout

  3. ~/.bash_profile or ~/.bash_login or ~/.profile (bash would choose the first one if the file exists for login shells)

  4. ~/.bashrc

  5. ~/.bash_logout

  6. ~/.inputrc

(For more information, see sections Invocation and Files in Linux man page bash)

If you want to use a non-interactive login shell, change the spec option shell_stdin to bash -s -l.

It’s not recommended to use interactive shells because interactive shells may require user inputs and get stuck if no user is present at the moment.