Linux Learning Note III (Linux system telnet)

Source: Internet
Author: User
Tags dns2 get ip key string nameserver ssh secure shell

Remote Login for Linux systems


The configuration file for the SSHD service is/etc/ssh/ssh_config//can modify this profile to implement the SSHD service you want. For example, you can change the boot port to 11587.


At present, the more common terminal login software is SECURECRT, Putty, SSH Secure shell and so on.


Download putty, you can go to the official website: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html


Linux Configuration IP


Fang Yi, get IP automatically

#dhclient

The premise of automatically acquiring an IP address is the DHCP service in the network environment where the native Linux is located. In short, as long as your real machine can automatically acquire IP, then the Linux installed on the virtual machine can also automatically acquire IP.


Square Two, manually set IP (direct connect mode)


Vi/etc/sysconfig/network-scripts/ifcfg-eth0 the following changes:

ipaddr=192.168.31.105//If it is connected with the real Machine bridge, it will be changed to the same network segment as the real machine, and if it is NAT, it will be changed to the same network segment as the NIC Vmware8.

netmask=255.255.255.0//Mask according to the actual situation, the author has made a mistake to write the NETMASK natmask, resulting in the 10.143.183.0 network segment mask Display as a 8-bit mask, actually 24-bit mask.

gateway=192.168.31.1//If it is connected to the real machine, it will be changed to the same gateway as the real machine, and if it is NAT, the gateway is the IP address of the NIC Vmware8 (which can be found in the network and Sharing center).

The dns1=192.168.31.1//dns can be written as a gateway address, and the NameServer 192.168.31.1 is automatically written to/etc/resolv.conf when the NIC is restarted. In addition, I have encountered a situation, in/etc/resolv.conf added NameServer 192.168.31.1, after a while to see this configuration information disappeared.

dns2=8.8.8.8//This DNS uses Google's DNS.

Onboot=yes//indicates boot start.

Bootproto=static//static indicates that a static IP address is used, and if you fill in DHCP, it is the dynamic acquisition of IP.


After you save the configuration file, restart the Network Services service network restart.


After the network restarts, the eth0 IP is in effect. Use the ifconfig/ifconfig-a/ifconfig eth0 command to see it.


Detects whether the configured IP can ping the gateway and public network, such as Baidu. The author uses the Windows7 system, so use CMD to open the Command window for detection. The shortcut key to open cmd is Windows + R.


Note: Ping 192.168.31.105


-T//indicates a continuous ping, and the no-t system will only ping 5 times.


Fang, using VMware's NAT to configure IP for Linux


Setting up NAT on a virtual machine

edit–> Virtual Network setting–> nat–> Vmnet 8 Gateway IP address:192.168.205.2 netmask:255.255.255.0 NAT service:started–> OK


To modify the network card settings for a virtual machine

Double-click the Small Network card icon in the lower right corner of the virtual machine, and the mouse will show "Ethernet: ..." After moving past. Device status both need to be hooked; Network connection need to select the last item (custom:specific virtual Network) Select Vmnet8 (NAT) Last click OK


to your computer.

Right-click Network Places –> Properties –> Right-click the VMware Network Adapter VMnet8 –> Properties –> Double-click Internet Protocol (TCP/IP) –> manually set IP to 192.168.2 05.1 Subnet mask for 255.255.255.0 gateway and DNS are set to 192.168.205.2–> OK –> OK


Set up your virtual machine IP

Edit the eth0 configuration file on your Linux vi/etc/sysconfig/network-scripts/ifcfg-eth0 content as follows:


ipaddr=192.168.200.100

netmask=255.255.255.0

gateway=192.168.200.2

dns1=192.168.31.2

dns2=8.8.8.8

Onboot=yes

Bootproto=static


Set DNS Address

Run the command vi/etc/resolv.conf content as follows:

NameServer 192.168.200.2


Restart Network Service

Run the Command service network restart



Log in to Linux with Putty


Complete Remote Linux basic information

Host Name (or IP address) This column fills in the IP you just configured in the previous section, Amin's Linux IP is "10.72.137.85".


The Port column remains unchanged by default.


Connection type also remains the default.


Saved Sessions here to customize a name, mainly used to differentiate the host, because in the future you have a lot of main opportunities, write a simple name is easy to remember and quick to find.


Defining character Sets

The most annoying thing in the computer is the character set, especially Linux, can not be garbled. The Chinese language support is installed in the installation of CentOS, so the installed system is supported in Chinese, and the putty is also supported in Chinese. Click "Window" –> "translation" on the left, see "Character set translation on received data" to the right, select UTF-8. Then click on the "Session" on the left, then click "Save" on the right.

Connect to your Linux remotely

After saving the session, click "Open" at the bottom of the point. When the initial landing, will pop up a friendship hint, it means to open the Linux has not yet registered in the local, asked if we should trust it. If it is trustworthy, then the point ' is ' to register the host, otherwise point ' no ' or ' Cancel ', of course we have the point ' yes '. After that, the login prompt appears:


After entering your username and password, you will be logged into the Linux system. When you log in, you will be prompted for the last time you logged in the system and where to log in.


Telnet to Linux using the key authentication mechanism


The SSH service supports a security authentication mechanism, that is, key authentication. The so-called key authentication, is actually using a pair of cryptographic strings, a public key (PublicKey), anyone can see its content for encryption, and the other is called the key (Privatekey), only the owner can see, for decryption. Ciphertext encrypted with a public key can be easily decrypted using a key, but it is difficult to guess the key based on the public key. SSH's key authentication is the use of this feature. Both the server and the client each have their own public key and key. How do I log on to a Linux server using key authentication?


1. Generate Key tool: Puyttygen.exe


2. Generate the key pair:

Double-click Puttygen.exe, the lower right corner "number of bits in a generated key" change "1024" to "2048", then click "Generate", so you start to generate the key, please move the mouse, so that you can quickly generate a secret The key pair was completed in about more than 10 seconds.

"Key Comment:" Here can remain unchanged and can be customized, in fact, is a simple introduction to the key;

"Kye Passphrase:" Here to give you the key to set the password, so secure some, of course, can also be left blank, it is recommended to set a password; "Confirm passphrase:" Enter the password you just set again.


3. Save the private key


Click "Save Private Key", select a storage path, define a name, and click "Save". Save to a safer place, beware of losing it or being seen by others.


4. Copy the public key to Linux


Back to the window where the key was generated, there is a long string below "key", which is the contents of the public key and copies the entire public key string. Then paste it into your Linux/root/.ssh/authoried.conf file.

#mkdir-pv/root/.ssh/

#chmod 700/root/.ssh/

#vi/root/.ssh/authorized.conf

Put the public key information into the file authoried.conf, note the name of the public key tail, different from the name to identify the public key.


5. Turn off SELinux

Method One:

#getenforce//Get selinux information.

#setenforce 0//temporarily close SELinux information. This is just a temporary command line to turn off SELinux and SELinux will open the next time you restart Linux.


Method Two:

#vi/etc/selinux/config

selinux=disabled//change SELinux to Disabled. In addition, enforcing represents execution, and permissive represents freedom.

Save restart after #reboot//change.


6. Set Putty to login via key


Open Putty.exe Click on your saved session, then click on the right side of the "Load", on the left, click on the "SSH" front of the + and then select "Auth", see the right "Private key file for authentication:" Below The bar is currently empty, click "Browse", find the private key we just saved, click "Open". At this point the box has the address of the private key, and of course you can edit the path yourself. Then go back to the left, click on the top "Session", and then click "Save" on the right.


7. Login to Linux with key verification

After saving the session, click "Open" at the bottom right. The landing screen appears, you will find that the original landing prompt content is different.


Login As:root

Authenticating with public key "rsa-key-20130509"

Passphrase for Key "rsa-key-20130509":

Last Login:thu-9 16:17:13 from 10.72.137.43

[Email protected] ~]#

Note: Now no longer enter the root password, but need to enter the password of the key, if you have not set the password before the production key, you enter the root will be directly logged into the system.



This article is from the "Sunwangbackup" blog, make sure to keep this source http://sunwangbackup.blog.51cto.com/10866322/1716195

Linux Learning Note III (Linux system telnet)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.