Skip to main content
edited body
Source Link
Desmond Hume
  • 3k
  • 6
  • 24
  • 21

I've got a script, named s, on a remote server that activates a virtual environment like this:

source venv/bin/activate

When SSH-ed into the server, I'm able to activate the environment by

. s

And I SSH into the server as following:

ssh -t host@useruser@host "cd /path/to/dir ; /bin/bash"

In addition to changing the working directory to /path/to/dir it would be nice if I could activate the environment right away each time I log into the server. But no matter where I put . s into the the SSH command, using -c for /bin/bash or not, the session always ends immediately.

I've got a script, named s, on a remote server that activates a virtual environment like this:

source venv/bin/activate

When SSH-ed into the server, I'm able to activate the environment by

. s

And I SSH into the server as following:

ssh -t host@user "cd /path/to/dir ; /bin/bash"

In addition to changing the working directory to /path/to/dir it would be nice if I could activate the environment right away each time I log into the server. But no matter where I put . s into the the SSH command, using -c for /bin/bash or not, the session always ends immediately.

I've got a script, named s, on a remote server that activates a virtual environment like this:

source venv/bin/activate

When SSH-ed into the server, I'm able to activate the environment by

. s

And I SSH into the server as following:

ssh -t user@host "cd /path/to/dir ; /bin/bash"

In addition to changing the working directory to /path/to/dir it would be nice if I could activate the environment right away each time I log into the server. But no matter where I put . s into the the SSH command, using -c for /bin/bash or not, the session always ends immediately.

Source Link
Desmond Hume
  • 3k
  • 6
  • 24
  • 21

SSH into a remote shell, execute a 'source' command, and stay in the remote shell

I've got a script, named s, on a remote server that activates a virtual environment like this:

source venv/bin/activate

When SSH-ed into the server, I'm able to activate the environment by

. s

And I SSH into the server as following:

ssh -t host@user "cd /path/to/dir ; /bin/bash"

In addition to changing the working directory to /path/to/dir it would be nice if I could activate the environment right away each time I log into the server. But no matter where I put . s into the the SSH command, using -c for /bin/bash or not, the session always ends immediately.