asuka-sato / parallel-ssh

Automatically exported from code.google.com/p/parallel-ssh
Other
0 stars 0 forks source link

pssh doesn't source any .*shrc file when running commands #52

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This may or may not be desirable to fix, but ssh sources a .*shrc file (or a 
login file, or something - I'm not totally sure which), so one might expect 
that pssh also sources the file.

The specific problem that I had was that I was running standardpso.py on the 
potatoes and it failed because it couldn't find mrs (that might sound funny to 
people outside the lab... =)  Oh well).  My PYTHONPATH variable that points to 
where mrs is gets set in .bashrc, so using ssh is just fine.  But it wasn't 
getting sourced when I used pssh, so it kept on failing.  When I figured out 
the problem, I just added an export line to the command I was running through 
pssh and things worked.

So there is an easy workaround, which could be writing a script that wraps a ". 
.bashrc" around the command you actually want to run and passing that script to 
pssh, but that's a little more hassle than would be convenient.  Not high 
priority, but it would be nice =).

Original issue reported on code.google.com by drai...@gmail.com on 1 Jul 2011 at 2:11

GoogleCodeExporter commented 8 years ago
When ssh connects, it doesn't run the login shell.  From the documentation: "If 
command is specified, it is executed on the remote host instead of a login 
shell."
If you run the same command manually with ssh, I presume you'll have the same 
errors, right?  With each shell, there are certain config files (like .bashrc 
or .zshenv) that are run for every instance of the shell, and other files (like 
.bash_profile or .zshrc) that are only run for login shells.  I don't think 
this is something that can change in pssh because it should try to keep the 
same behavior as a straight ssh whenever possible.

Of course, if pssh is behaving differently than ssh, then I take it all back. :)

Original comment by amcna...@gmail.com on 1 Jul 2011 at 3:22

GoogleCodeExporter commented 8 years ago
Oh, I see.  I didn't realize you could run commands just using ssh.  You're 
right (surprise, surprise... =) ).  When I said, "ssh sources a .*shrc file," I 
meant when I log on to a machine through ssh.  Oops.  But that's why I left the 
"may or may not be desirable to fix" bit, as I figured there might be something 
I didn't know.

So, ignore this bug.  PEBKAC.  But as an aside, is there a place I could put 
path variable exports and have them run by ssh and pssh without needing a login 
shell?

Original comment by mgard...@google.com on 1 Jul 2011 at 3:30

GoogleCodeExporter commented 8 years ago
You could either set things for your shell (such as bash or zsh) as I mentioned 
in comment #1.  Alternatively, ssh has some things like ~/.ssh/environment and 
~/.ssh/rc that you could look into.

Original comment by amcna...@gmail.com on 1 Jul 2011 at 6:16