Practical uses of SSH
1. As you know, ssh is configured on port no 22. Due to security
reason, your team lead asked you to change the port number. How will
you perform this task?
Ans: First open the configuration file say (/etc/ssh/ssh_config) and
then search for Port .Change it to the any other port number 3xxx or
available port no. After doing this restart the ssh service using
service ssh restart command.
In above diagram, as you can see we are changing the port number from
22 to 3xxx.
Benefits: It provide more security.
2. Suppose you are taking care of Linux server but forget to
disable the root login.How will you disable the root login?
Ans: First open the configuration file say (/etc/ssh/ssh_config) and
then search for this string “PermitRootlogin” and make it to no.
After doing this restart the ssh service.
As you can see in the above diagram we are disabling the root
login.It is highly recommended not to enable the permitrootlogin in
the production environment.
3. Suppose you are working with multiple numbers of Linux server
and while login, every time you need to give a password.What is the
solution for this?
Ans: First create the public key as well as private key using
ssh-keygen command and copy the
public key using ssh-copy-id to the remote server.
As you can see in the above diagram first we creating public as well
as private key and copy the public key to the remote server.
Note: After doing this verify whether you are able to login without a
password or not.
4. Suppose In your organization there are multiple groups as well
as users. Is it possible to give them SSH server access? If yes how
will you perform this task?
Ans: First open the configuration file(/etc/ssh/ssh_config) and add
users as well as group.Below is the Syntax:
AllowUsers Username
AllowGroups Groupname
Save the file and restart the ssh service.
As you can see in the above diagram we are adding the users as well
group in the configuration file. After that restart the ssh service.
5. As you know ssh having two protocol ie is protocol 1 and
protocol 2. Out of these two which one is more secure and where you
have to edit these changes?
Ans: Protocol 2 is more secure than Protocol 1. Open the
configuration file and add the “Protocol 2” . After that restart
the ssh service.
As you can see in the above diagram we are adding the protocol 2 in
the ssh configuration file
and then we need to restart the ssh service.
Note: In protocol 2 there are multiple authentication forms as
compared to protocol 1.
Click on below link to explore Linux Practical Examples:
https://payhip.com/b/247HD
https://payhip.com/b/247HD
6. Suppose, you want to know the list of IP who try to do login
attempt into your Linux server without proper authentication. Where
are the logs will be stored?
Ans: It will be stored under /var/log/secure.It contains the
information related to authentication and
authorization privileges.From the point of security, it is a very
useful directory.
As you can see in the above diagram all failed login attempt
information is stored in the /var/log/secure.
7. Suppose you want to access the ssh server without giving the
password manually.But it should take a password from the file. Is
this possible? if yes, How will you do this?
Ans: ssh username@remoteserver << filename.txt
By applying above command you don't need to enter the password
manually. It will fetch the password from the file.In this way, we
provide more security to our Linux server.
As you can see in the above diagram we are login to the remote server
with the help of file which contains the password information.
8. Suppose you are transferring the data using ssh connection but
it is very slow. So what type of cipher will you use to increase the
speed?
Ans: Blowfish is a cipher which is used to increase the speed of data
transfer by encrypting the data. A Command is: scp -c blowfish
filename.txt username@remote.
As you can see in the above diagram we are using blowfish cipher to
transfer the data from local to the remote machine.
9. Suppose you are facing issue while logging to ssh server. In
this case, what will you do to troubleshoot?
Ans: We will use -v option to debug the issue.Below is the command:
ssh -v username@Remotemachine
Above command give you all the logs.
As you can see in the above diagram we are using -v option to find
the login issue to the remote machine.
10. After copying a large file over the network to the ssh server.
You started facing network issue. What will you do to get rid out of
this problem?
Ans: We will limit the bandwidth using -l option while transferring
the file over the network.Below is the command:
Scp -l 50kb/s filename username@remote-machine
l option is used to limit the bandwidth.
As you can see in the above diagram while tranferring the large file
we need to limit the bandwidth to improve the network.
Click on below link to explore Linux Practical Examples:
https://payhip.com/b/247HD
https://payhip.com/b/247HD










Comments
Post a Comment