Add new comment

Want to support HowtoForge? Become a subscriber!
Submitted by thomasiweb (registered user) on Thu, 2008-05-29 14:33.

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 :) 

Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.

Reply

*
*
The content of this field is kept private and will not be shown publicly.


*

  • Images can be added to this post.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <div>
  • Lines and paragraphs break automatically.