I am in a situation where several users are sharing the same user account on a remote machine. I have a "personal" directory where I wrote my own .zshrc
file, and I would like to have a way to:
- Start a ssh session in the remote machine with directives from my ssh config file
(e.g.
ControlMaster auto
) - This session runs a Z shell
- It runs a
.zshrc
in my "personal" directory (not on the shared user's home directory)
It would be nice to have an alias or a simple way of starting such ssh sessions (that's why I thought about using the OpenSSH's config file), but I am open to any other ideas!
Using OpenSSH's config file?
I read on the OpenSSH's ssh_config man page that I can use the directive LocalCommand
to specify a command to run locally after successfully connecting to the server. This made me think there may be a way to tell the config
file what command to run remotely after connecting to the server, but there doesn't seem to be any.
ssh mycommand
? And if you want to run some setup command before every command that comes over ssh, why not configure the server side? – Gilles 'SO- stop being evil' Sep 14 '11 at 23:22.zshrc
in a specific directory (i.e. a "personal" home directory). I triedssh -t host_name 'zsh & source /path/to/my_zshrc'
but it didn't work (I gotFPATH variable not defined
, and I think it is becausezsh
finishes before it runsmy_zshrc
, let alone this didn't give me a Z shell) – Amelio Vazquez-Reina Sep 14 '11 at 23:28