top of page

SSH

Writer's picture: easSylinuxeasSylinux

Updated: Dec 30, 2017

1) What is ssh?


Ans:- SSH  (secure shell) is a protocol for creating a secure connection between two systems. SSH is Known for its high security, cryptographic behavior and it is most widely used by server administrators to control remote web servers primarily.


2) On which port SSH work?                      


Ans:- 22


3) Which package we used to configure SSH?


Ans:- openssh-server and openssh-client


4) What is the main configuration file for SSH server?


Ans :- /etc/ssh/sshd_config


5) What is the main configuration file for SSH client?


Ans :- /etc/ssh/sshd_config


6) How to restart the service of SSH server in Linux?


Ans :- Service sshd restart   (in RHEL-6)

          systemctl rsestart sshd  (in RHEL-7)


7) How to enable the service of SSH server in Linux?


Ans :- chkconfig sshd on   (in RHEL-6) 

          systemctl enable sshd (in RHEL-7)


8) I want to change SSH port no, how can I?


Ans:- To change the port number we need to modify the configuration file of SSH. Open main configuration file of SSH i.e /etc/ssh/sshd_config  with vim editor, and search for the line Port 22 and replace 22 with any un-used port no  save the file and restart the ssh service.


9) How to disable root login on SSH server?


Ans:- We need to change the parameter ”PermitRootLogin” to no in the configuration file to disable direct root login.


10) How will you allows users and groups to have access to SSH Sever?


Ans:-we need to edit the configuration file of SSH service. Open the configuration file and add users and groups with AllowUsers and AllowGroups parameters  at the bottom as show below and then, restart the ssh service.


For example-


# vim /etc/ssh/sshd_config

Press Shift + G (to go bottom of a file)

AllowUsers  user1 user2

AllowGroups  group1 group2

:wq (save a file)

# service sshd restart (in RHEL-6)

# systemctl sshd restart (in RHEL-7)


11) How will you deny users and groups to restrict access to SSH Sever?


Ans:-we need to edit the configuration file of SSH service. Open the configuration file and add users and groups with DenyUsers and DenyGroups parameters at the bottom as show below and then, restart the ssh service.


For example-


# vim /etc/ssh/sshd_config


Press Shift + G (to go bottom of a file)

DenyUsers  user1 user2

DenyGroups  group1 group2

:wq (save a file)


# service sshd restart (in RHEL-6)

# systemctl sshd restart (in RHEL-7)


12) I want to trace unauthorized login attempts over SSH Server, it is possible?


Ans:-Yes, we can find the failed login attempts in the log file created at location   “/var/log/secure”.


13) what is the use of scp command?


Ans:-  scp stands for secure copy and we used scp command to copy files over ssh.


For example-


Copy the file "happy.txt" from a remote host to the local host


# scp  username@remotehost-ip :/happy.txt  localhost_destination

# scp root@172.25.254.250:/happy.txt  /home/linux/


14) How to check ssh server versions ?


Ans:- we the helo of  “ssh  -V “ command we can check ssh servers version.


15) How to copy the file  “info.txt” from the local machine to a remote host using port 333 in /backup directory.


Ans:- scp  –p  333  /root/info.txt root@server11.example.com:/root/backup


16) what are the features of SSH?


Ans:- 1. Access the remote machine securely          2. Authentication mechanism (Public Key authentication)          3. Secure File transfer          4. Port forwarding


17) What is the command to access remote machine using SSH?


Ans:- ssh  ip-address/hostname

For example :-   ssh  172.25.254.250


18)How to execute commands in remote machine using SSH ?


Ans:- ssh user_name@ip-address/hostname "ls -ltr"

For example:-  ssh root@172.25.254.250  "ls -ltr"


19) what is the difference between SSH and SCP ?


Ans:- SSH is used for secure connection between hosts for command

         SCP is used for secure connection between hosts for file transfer operation.


20) How do find all failed login attempts via ssh?


Ans:- tail -f /var/log/secure | grep Failed

                                                                                                           

GOOD LUCK ! 

25 views0 comments

Recent Posts

See All

HTTPD

1) What does Apache server mean? Ans:- Apache Web Server is designed to create Web servers that have the ability to host one or more...

YUM

1) How to check the installed software (rpm’s) on Redhat Linux ? Ans:- rpm -qa package_name (or) rpm -qa | grep package_name* For...

NFS

1) Why we use NFS server? Ans :- we used NFS (Network File Sharing) server to share a file or a directory over the network but we can...

Comments


Never Miss a Post. Subscribe Now!

connect with us and stay in loop with easSylinux

© easSylinux
bottom of page