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
19 hours 11 min ago
20 hours 39 min ago
1 day 14 min ago
1 day 3 hours ago
1 day 6 hours ago
1 day 6 hours ago
1 day 7 hours ago
1 day 8 hours ago
1 day 9 hours ago
1 day 9 hours ago