Using SSH to manage your computer remotely, you don't have to go back and forth to the actual location of your computer.
Environment: Server: CentOS6.6, client win8.1 putty
To configure the server:
1, check the sshd is installed (by default, the system comes with), using the command
Rpm-qa |grep SSH
The result is that the installed
[Email protected] ~]# Rpm-qa | grep sshlibssh2-1.4. 2-1. El6.i686openssh-server-5. 3p1-104. El6.i686openssh- 5. 3p1-104. El6.i686openssh-clients-5. 3p1-104. el6.i686
Install using the following command if it is not installed
Yum Install Openssh-server
2. Start SSH and restart with the following command
Service sshd Restart
The results are as follows
[[Email protected] ~]# service sshd Restart stop sshd: [OK] starting sshd: [OK]
3, check whether the 22 port is in listening state, using the command
NETSTAT-ANTP |grep sshd
The results are as follows:
[Email protected] ~]# NETSTAT-ANTP |grep sshdtcp0 0 0.0.0.0: A 0.0.0.0:* LISTEN1332/sshdtcp0 0 192.168.116.130: A 192.168.116.1:51202Established1271/sshdtcp0 0::: A:::* LISTEN1332/sshd
4. Check if 22 ports are released (called Allow 22 port Outbound in Windows), use the command
Iptables-nl
The results are as follows
[Email protected] ~]# iptables-Nlchain INPUT (policy ACCEPT) target prot opt source destinationaccept all--0.0.0.0/0 0.0.0.0/0State related,establishedaccept ICMP--0.0.0.0/0 0.0.0.0/0ACCEPT All--0.0.0.0/0 0.0.0.0/0ACCEPT TCP--0.0.0.0/0 0.0.0.0/0State NEW TCP DPT: AREJECT All--0.0.0.0/0 0.0.0.0/0Reject-with icmp-host-Prohibitedchain FORWARD (policy ACCEPT) target prot opt source Destinationreject all--0.0.0.0/0 0.0.0.0/0Reject-with icmp-host-Prohibitedchain OUTPUT (policy ACCEPT) target prot opt source destination
Below we set up the client, the author uses the client as Putty
1, first we need to obtain the IP address of the server, the simplest way to use the following command
Ifconfig
The results obtained by the author
[[Email protected] ~]# ifconfigeth0 Link encap:ethernet HWaddrxx: 0C: in: -: f6:6a inet Addr:192.168.116.130Bcast:192.168.116.255Mask:255.255.255.0Inet6 addr:fe80::20c:29ff:fe64:f66a/ -scope:link up broadcast RUNNING multicast MTU: theMetric:1RX Packets:1813Errors0Dropped0Overruns:0Frame0TX Packets:208Errors0Dropped0Overruns:0Carrier0Collisions:0Txqueuelen: +RX Bytes:172124(168.0KiB) TX Bytes:35245(34.4KiB) Interrupt: +Base Address:0x2000lo Link encap:local Loopback inet addr:127.0.0.1Mask:255.0.0.0Inet6 Addr: ::1/ -scope:host up LOOPBACK RUNNING MTU:65536Metric:1RX Packets:0Errors0Dropped0Overruns:0Frame0TX Packets:0Errors0Dropped0Overruns:0Carrier0Collisions:0Txqueuelen:0RX Bytes:0(0.0b) TX Bytes:0(0.0b
As you can see, the IP address obtained by the author is 192.168.116.130
2. Open Putty, enter the following parameters: ip:192.168.116.130 (IP obtained from previous command), port number: 22, Login: SSH, click Open
In the pop-up window if there is a confirmation of the certificate, the first point of confirmation, and then the User Name Password Authentication window, enter the CentOS user name password can be, note that the password is not echoed.
as : Root[email protected] 192.168. 116.130 ' s Password: Last Login:sat 9:Panax notoginseng: from192.168 . 116.1 ~]#
CentOS Configuration sshd