Birmingham mumbai


Simplifying SSH connections with a



Download 15,21 Mb.
Pdf ko'rish
bet355/482
Sana13.01.2022
Hajmi15,21 Mb.
#355107
1   ...   351   352   353   354   355   356   357   358   ...   482
Bog'liq
Mastering Ubuntu Server Gain expertise in the art of deploying, configuring, managing, and troubleshooting Ubuntu Server by Jay LaCroix (z-lib.org)

Simplifying SSH connections with a 
config file
Before we leave the topic of OpenSSH, there's another trick that benefits convenience, 
and that 
is the creation of a local configuration file for SSH. This file must be stored 
in the 
.ssh
 directory of your home directory, and be named 
config
. The full path for 
this file in my case looks like this:
/home/jay/.ssh/config


Chapter 10
[
 271 
]
This file 
doesn't exist by default, but if it's found, SSH will parse it whenever you use 
the client and you'll be able to benefit from it. Go ahead and open this file in your 
text editor, such as 
nano
:
nano /home/your_username/.ssh/config
This 
config
 file allows you to type configuration for servers that you connect 
to often, which can simplify the 
ssh
 command automatically. The following are 
example contents from such a file that will help me illustrate what it does:
host myserver 
    Hostname 192.168.1.23 
    Port 22 
    User jdoe 
 
Host nagios 
    Hostname nagios.mynetwork.org 
    Port 2222 
    User nagiosuser 
In the example contents, I have two hosts outlined, 
myserver
 and 
nagios
. For each, 
I've identified a way to reach it by name or IP address (the 
Hostname
 line), as well as 
the 
Port
 and 
User
 account to use for the connection. If I use 
ssh
 to connect to either 
Host
 by the name I outlined in this file, it will use the values I have stored there, for 
example:
ssh nagios 
That command is a lot shorter than if I set all the options manually. Considering I 
have a 
config
 file for SSH, that command is essentially the same as if I identified the 
connection details manually, which would've been the following:
ssh -p 2222 nagiosuser@nagios.mynetwork.org 
I'm sure you can see how much simpler it is to type the first command than the 
second. With the 
config
 file for SSH, I can have some of those details automatically 
applied. Since I've outlined that my 
nagios
 server is located at 
nagios.mynetwork.
org
, its SSH user is 
nagiosuser
, and it's listening on port 
2222
, it will automatically 
use those values even though I only typed 
ssh nagios
. Furthermore, you can also 
override this entry as well. If you provide a different username when you use the 
ssh
 
command, it will use that instead of what you have written in the 
config
 file.


Connecting to Networks

Download 15,21 Mb.

Do'stlaringiz bilan baham:
1   ...   351   352   353   354   355   356   357   358   ...   482




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish