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
1 hour 39 min ago
2 hours 28 min ago
5 hours 5 min ago
5 hours 29 min ago
7 hours 23 min ago
11 hours 34 min ago
14 hours 45 min ago
15 hours 57 min ago
18 hours 59 min ago
22 hours 45 min ago