[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Need a tutorial



On 09/22/2016 07:30 PM, Gene Heskett wrote:
> On Thursday 22 September 2016 11:16:45 Dominique Dumont wrote:
...
>> Others have explained how to generate keys. Then you can simplify the
>> process by setting up your ~/.ssh/config file with something like:
>>
> Interesting, I don't have that file, its all in /etc/ssh.

ssh_config is probably the most under-appreciated part of the client.
Yet it's very useful.  Even a lot of 3rd party tools work with it.

The global file is /etc/ssh/ssh_config.  Most users have one located in
~/.ssh/config  For both, the full documentation is in the manual page
for "ssh_config".  If you add a lot of options then it saves a lot of
work to put them in ~/.ssh/config

If the file does not exist, you can make it with your choice of editor.
It follows the basic structure of Host + a pattern or name, followed by
options for that pattern or name.  For example, these blocks add a set
of options below for two remote hosts:

	Host 5501
	  Hostname 203.0.113.22
	  IdentitiesOnly yes
	  IdentityFile ~/.ssh/key_22_ed25519
	  AddKeysToAgent yes
	  ServerAliveCountMax 2
	  ServerAliveInterval 30
	  Port 2223

	Host 33
	  User xyzzy
	  HostName 203.0.113.11
	  ControlPath ~/.ssh/controlmasters/%r@%h:%p
	  ControlMaster autoask
	  ControlPersist yes

The first host with its set of options is available via "ssh 5501", just
as the second one is available via "ssh 33".  The latter would be the
equivalent of

  ssh -o ControlPath=~/.ssh/controlmasters/%r@%h:%p \
	 -o ControlMaster=autoask \
	 -o ControlPersist=yes \
	 xyzzy@203.0.113.11

Or something like that.

I recommend grabbing a refreshment, finding a comfy chair, and working
through the manual page for ssh_config paragraph by paragraph at least
once if you connect to a lot of servers or use a lot of options when
connecting.

Regards,
Lars


Reply to: