SSH action issues

1. Command not found

Error:

Command not found

Solution:

If you’re sure the execution command is correct, check the .bashrc file on the server. The file allows you to ignore commands executed in non-interactive mode. Make sure to remove or comment the config for non-interactive executions. It is usually preceeded with a line like this:

# If not running interactively, don't do anything

The config may look different depending on the system, for example:

# If not running interactively, don't do anything

case $- in

    *i*) ;;
      *) return;;
esac

or

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

If you are exporting the PATH variable in the ~/.bash_profile file, the variable will not be available in the SSH action because the file is run in interactive mode. In order for the action to run properly, move the exported PATH variable to the ~/.bashrc file.

2. Timeout error

Error:

The command times out after 10 minutes although a higher timeout is set in the action.

Solution:

  1. Go to SSHD config on your server. On Linux it can be mostly found in the /etc/ssh/sshd_config file.

  2. Apply a setting that will send null packages to the client in intervals shorter than 10 minutes, for example:

ClientAliveInterval 120
  1. On top of that, you need to control the number of keep-alives sent to a client per session:
ClientAliveCountMax 720
  1. Restart daemon SSHD.

3. Base64: not found

Error:

base64: command not found

Solution:

If you want to run commands as a script, you need to install Base64 on your server. Otherwise, go to the Execution mode at the bottom of the action and switch it to Run every command in a separate context.

Sign up for Buddy Digest

Best practices on CI/CD and fresh changelogs delivered weekly to your inbox.