Package not found via ssh

If I ssh into my VPS as a deployment user and run bundle -v , I get Bundler version 1.1.5 as expected.

If I run ssh deployment@123.123.123.123 bundle -v , then I see bash: bundle: command not found

Why is the list of running commands via ssh not displayed?

Additional Information

 $ cat ~/.bashrc # ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # for examples if [ -d "${RBENV_ROOT}" ]; then export PATH="${RBENV_ROOT}/bin:${PATH}" eval "$(rbenv init -)" fi # If not running interactively, don't do anything [ -z "$PS1" ] && return 
+6
source share
2 answers

At startup:

 ssh deployment@123.123.123.123 

You get a login shell on a remote host, which means that your shell will start (... for bash ...) .bash_profile or .profile or AS WELL AS is equivalent to your initialization file for each shell.

At startup:

 ssh deployment@123.123.123.123 some_command 

This does not start the login shell, so it only runs the initialization file for each shell (e.g. .bashrc ).

The problem you described usually means that you need something in your .profile file (usually an environment parameter) for everything to work.

+4
source

.profile is loaded only for login systems.

 ssh deployment@123.123.123.123 

will give you a login shell but

 ssh deployment@123.123.123.123 bundle -v 

will not.

You could put the appeal of rbenv in .bashrc, but if it is a one-time deal, it might be that clean just to attach it to your ssh command like this:

 ssh deployment@123.123.123.123 "export PATH=\$HOME/.rbenv/bin:\$PATH; eval \"\$(rbenv init -)\"; bundle -v" 
0
source

Source: https://habr.com/ru/post/921720/


All Articles