Xshell connection to the Virtual Machine Ubuntu

Source: Internet
Author: User
I thought cygwin could be the same as the real Linux, but after a while I found it was totally different from what I imagined. So I thought of installing a virtual machine. Because I have been using a virtual machine during Ubuntu, I did not consciously think of the virtualbox of Oracle and installed ubuntu. This is easy to install, however, I still recorded the steps, but I suddenly forgot the steps that day. (A bug in virtualbox_4.3.14 may cause installation errors. Please do not download the software of this version.) 1. create-> name (if any, we recommend that you use Ubuntu 32 or later), type (Linux), and version (select Ubuntu 32bit as needed. memory Allocation. I used to use 512 MB by default. However, after using the memory, I found it was too slow and then gave it 1 GB, 2 GB memory is acceptable (8 GB memory on my computer ). 3. If you have already created a virtual hard disk, you can use the existing one. In this way, you can keep the previous items and feel this is very convenient. We recommend that you do not store the image on disk C because it is permanently available. If you change your computer, simply copy the image. 4. After the basic configuration is complete, start the installation. Click the system you created-> Settings-> storage tab, add an IDE disk, and select your system image. We recommend that you do not configure the network at this time, because during Ubuntu installation, if the network is connected, software such as the update package and Language Pack will be downloaded for a long time. 5. it is easy to install the system. Let's talk about the key points. Generally, you can install the system in other ways, configure the root directory, and switch partitions. you can install the system at this time, however, we recommend that you divide a virtual hard disk into three partitions: one as the root partition, one as the swap partition, and the other as the data partition. The structure should be like this:/root swap/data (liuliang, I usually use my own name for this partition). If the system will encounter major bugs that cannot be fixed in the future, the data in your data partition is saved, so it is necessary to create such a partition. If your virtual partition is 30 GB, the/root partition should be around 5 GB, it is mainly used to install the system. The swap partition is 2 ~ 4 GB, and the rest is the data partition. 6. The installation is complete by default. It is easy to install the system. Now xshell is connected to the virtual machine. 7. The xshell method to connect to a virtual machine is simple, that is, to enable the sshd service on the virtual machine.
 
 
  1. // Install the sshd service
  2. $ sudo apt-get install openssh-server
  3. // Enable the Service
  4. $ /etc/init.d/ssh start
  5. // Close the service
  6. $ /etc/init.d/ssh stop
  7. // Restart the service
  8. $ /etc/init.d/ssh restart
8. There are two ways to connect to a virtual machine. 1) The network of the Virtual Machine and the network of the physical machine are connected to one route. 2) the network adopts the NAT connection mode and port ing mode. 8.1 click the settings menu-> network tab, select the connection mode (bridging mode), and then manually configure the IP address under Ubuntu (do not use DHCP for allocation, this allocation method should not be the IP address assigned by dhcp on the vrodhcp. I have not studied how to allocate it ). It is probably a firewall problem to ensure that the above settings are correct. If you still cannot connect to xshell, you can simply turn off the firewall of the physical machine. 8.2 click the settings menu-> network tab, select the connection mode (Network Address Translation Nat mode), and click port forwarding below. Do not change the Protocol or anything, just map the port 22 of the VM to the custom port of the physical machine (0 is not used, 1 ~ 1023 the system is retained. Only the root user has the permission to use the service ~ 4999 allocated by users, 5000 ~ 65535 is allocated by the server, so the port you define should be in port 1024 ~ Within the range of 4999 ). For example, if the IP address of my physical machine is 192.168.2.3 and the IP address of the virtual machine is 10.0.2.15 (this address is used by default), the configuration should be like this.
Why port 22? The sshd service uses port 22 by default. Of course, this port can be modified. Why is it TCP or UDP, because the protocol used by sshd is TCP/UDP, does it feel the same as it did not say. For more information, see
 
 
  1. /etc/services
This file records the network service names and their corresponding port numbers and protocols in the system by default. Please don't edit it! 9. modify the port number of the sshd service. port 22 is used by default, and the sshd service is enabled by default, which is very dangerous, it is very vulnerable to intrusion (Of course I do not understand), so you need to modify it. The Linux configuration files are generally named xx_config and XX. in the format of config, XX-config, and XX-xxconfig, enter the SSD folder and find the files of this type. If there are multiple files, check the names. Here is the name. You can easily understand it when you enter it. There is nothing to say.
 
 
  1. /etc/ssh/sshd_config



From Weizhi note (wiz)

Xshell connection to the Virtual Machine Ubuntu

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.