setting current dir of remote shell
Bob Proulx
bob at proulx.com
Tue May 1 00:43:15 EST 2007
Dave Yost wrote:
> Thanks for pointing out the subtleties of exec -l.
>
> But there's a problem.
>
> Zsh doesn't support exec -l but instead supports "zsh -l".
Oh well... I was aware that csh did not support 'csh -l' but not
being a zsh user I did not know about it. But it is not required by
POSIX and so is really only available opportunistically.
> Doing what you propose doesn't work when the remote shell is zsh.
> And doing it the way that works for remote zsh fails with remote bash.
>
> Is this the unsolvable problem it appears to be?
Unsolvable? I am not sure how much of a real problem it would be in
that case.
A bigger problem that I think has been discussed before without
resolution that I recall is that ssh is compatible is rsh and invokes
the /etc/passwd specified shell. That can be a different shell on
different hosts. This can make it difficult to write scripts that use
ssh to invoke commands on remote hosts.
I wish ssh had an option (e.g. -oCommanShell=/bin/sh) that specified
to ignore the /etc/passwd shell and instead always invoke /bin/sh (or
other POSIX shell) on the remote machine. Because for me not having a
known syntax that works on all machines is difficult to work around.
But if I could say 'ssh -oCommandShell=/bin/sh' and guarantee invoking
/bin/sh instead of csh, ksh, etc. that was configured for that account
I could more easily make use of ssh in batch mode.
There are two problems that I see. One is that I always want to get
the POSIX shell to execute scripts. But I prefer a different shell
for interactive use. So normally for me the configured won't be a
POSIX shell. Presently ssh (AFAICT) does not give a way to get to a
POSIX shell on the remote machine. ('ssh $HOST /bin/sh -c "cmd args"'
almost works but requires an extra layer of shell quoting in the
account's shell.) Two is that often admins don't set up accounts
locally (NIS/YP, LDAP) and users are often not given the ability to
change their shell in the remote database. Argh. I hate that. I am
often stuck with csh on a system and am unable to change it.
This is a related problem of reliably invoking commands on the remote
machine. I think that is the first layer of the problem.
Bob
More information about the openssh-unix-dev
mailing list