2015年9月21日 星期一

Linux how to install update SSH

http://www.tecmint.com/install-openssh-server-in-linux/

On RHEL/Centos/Fedora

Type the following yum command to install openssh client and server.
# yum -y install openssh-server openssh-clients

Configuration of OpenSSH

It’s time to configure our OpenSSH behaviour through the ssh config file, but before editing the/etc/ssh/sshd_config file we need to backup a copy of it, so in case we make any mistake we have the original copy.
Open a terminal and run the following command to make a copy of the original sshd configuration file.
$ sudo cp /etc/ssh/sshd_config  /etc/ssh/sshd_config.original_copy
As you can see from the command I typed, I added the original_copy suffix, so every time I see this file I know it is an original copy of the sshd config file.

 nc -v -z 127.0.0.1 22
Referring to the netcat results, the ssh service is running on port 22 on my machine. Very good! What if we want to use another port, instead of 22? We can do that by editing the sshd configuration file.
Set your OpenSSH to listen on TCP port 13 instead of the default TCP port 22. Open the sshd_config file with your favourite text editor and change the port directive to 13.
# What ports, IPs and protocols we listen for
Port 13
Restart OpenSSH server so the changes in config file can take place by typing the following command and runnetcat to verify if the port you set for listening is open or not.
$ sudo /etc/init.d/ssh restart
Should we verify is our openssh server is listening on port 13, or not?. This verification is necessary, so I am calling my lovely tool netcat to help me do the job.
# nc -v -z 127.0.0.1 13
Do you like to make your openssh server display a nice login banner? You can do it by modifying the content of/etc/issue.net file and adding the following line inside the sshd configuration file.
Banner /etc/issue.net

沒有留言:

張貼留言