Add new comment
|
Have you tried using the config file? I beleive it would be more simple. create a config file for you user, usually ~/.ssh/config
In it you can put the following
host=host1 user=root
host=host2 user=admin port=23230
You can also use wildcards
host=*domain.com port=12345
Personnaly I have to connect to many servers as the user admin, so I have the following:
host * user=admin
another useful option is ControlMaster auto ControlPath /tmp/%h this creates a control file in /tmp. This lets you open new sessions on the same host without reauthenticating yoruself. I put this in the host * block.
Since scp/rsync etc use ssh, these settings apply to them also. In addition these specify "defaults". For example even though I specify admin as the user for all hosts, if I run ssh root@host it will overwrite the setting and conenct as root. Hope these help :)
Reply |




Recent comments
4 hours 42 min ago
10 hours 8 min ago
11 hours 10 min ago
11 hours 56 min ago
14 hours 2 min ago
14 hours 12 min ago
16 hours 43 min ago
17 hours 32 min ago
20 hours 9 min ago
20 hours 33 min ago