3

There is a way to forward my private keys to the server im connected with the ssh -A option. Is there is a way to forward the .ssh/config file as well? Its where I keep host aliases and default usernames. Its not possible to write .ssh/config on those servers because they are shared accounts.

Jake
  • 443
  • 1
  • 4
  • 6
  • 3
    Why do you need to forward your config? Are you using this server as a relay? Have you considered using [ProxyCommand](http://serverfault.com/questions/72343/ssh-relay-server-with-openssh/72347#72347) to connect directly to the host you want? – Zoredache Jun 02 '11 at 23:57

4 Answers4

1

Since you can't overwrite /.ssh/config, add your own alias and reference it, as in:

jake@localhost: scp .ssh/config remoteserver:/home/jake/.sshjake/

jake@localhost: ssh remoteserver

jake@remoteserver: alias ssh='ssh -F ~/.sshjake/config'

jake@remoteserver: ssh someotherserver
JesseDyer
  • 153
  • 7
0

I do it with a copy command to combine multiple config--a config--b files into config file, just remember to edit in sub files.

cp config-* config

Pieter
  • 778
  • 7
  • 11
0

No, there's no way to do that via any standard ssh clients that I know of; I'd be surprised if a client with such functionality exists as it's kind of an out-of-scope `feature'.

Given that it's a shared account (ouch), I wouldn't want to have any such configuration data there to begin with though, but that's your call :)

khosrow
  • 4,163
  • 3
  • 27
  • 33
0

Not directly, but if you want to manage a shared config file (say, you want to store your config files in a local git repository), you can do something like:

mkdir -p cfg/ssh
cp .ssh/config cfg/ssh/config
rm .ssh/config
ln -s cfg/ssh/config .ssh/config

Check the original file (now ~/cfg/ssh/config) into your repo, then check out a copy on your other machine(s) and set them up the same way.

Just remember to make sure you set permissions on your ~/cfg directory such that folks you don't want snooping about in there can't. 600 or 700 is generally fine.