The config file can automate many tedious processes.
Eg: You wish to scp a file from the current machine to a host like XDA, using a specific identity key. Of course you can use ssh-add to add the key, but it may not be recognized each reboot.
The usual command is like
scp -i ~/.ssh/path_to_keyfile sourcefilename [email protected]:~/targetpath
Once a .config file is set up, your new command becomes:
scp sourcefile xda:target
Create a text file in ~/.ssh/config:
[email protected]:~$ cat /home/droidzone/.ssh/config Host bitbucket IdentityFile ~/.ssh/bitbucket Host xda HostName build1.dev.xda-developers.com User droidzone IdentityFile ~/.ssh/xdamachine_key_openssh_pvt ServerAliveInterval 30 ServerAliveCountMax [email protected]:~$
Here, as you can see, I’ve added two hosts. One is my Bitbucket account, and I’ve specified a key file for authentication.
For XDA, I’ve given it a label “xda”, specified the build server username and hostname, specified an identity file, and a timeout interval.
Joel G Mathew, known in tech circles by the pseudonym Droidzone, is an opensource and programming enthusiast.
His favorite pastime is grappling with GNU compilers, discovering newer Linux secrets, writing scripts, hacking roms, and programs (nothing illegal), reading, blogging. and testing out the latest gadgets.
When away from the tech world, Dr Joel G. Mathew is a practising ENT Surgeon, busy with surgeries and clinical practise.