XShell5 connecting an Ubuntu virtual machine

Source: Internet
Author: User
Tags save file ssh

When you connect in this way, you always connect to a virtual machine, and you are always prompted could not connect to


On the internet to find a half-day data only found because my virtual machine does not have the SSH service caused by

To solve this problem:
To install the Openssh-server first, install it with the following command if it is not installed:
sudo apt-get install Openssh-server
Then check if SSH is started with the following command:
Ps-e | grep ssh
If only ssh-agent indicates that it is not started, you need to
/etc/init.d/ssh start.


Once you have done this, use Xshell to connect to the virtual machine again, and then eject this


Then the interface of the Xshell virtual machine appears


This situation occurs because SSH does not allow the root account to log on remotely

The workaround is: Modify the SSH configuration file/etc/ssh/sshd_config

Modify Vim/etc/ssh/sshd_config
Find # Authentication:
Logingracetime 120
Permitrootlogin without passwd
Strictmodes Yes
Change into
# Authentication:
Logingracetime 120
Permitrootlogin Yes
Strictmodes Yes

But only if you need to log in with the root account to modify it, or it will show ' readonly ' option is set (add! To override)

Log in to the root account using Su-root, and then make changes

If the root user is not configured, use sudo passwd root to enter the password as prompted, and then log on for the operation.

After the modification is complete:


First press ESC to return to command mode;

VI Save the file has different options, corresponding to different commands, you can choose from the following command to a need;

: w save file but do not exit VI

: W file saves the modification to file and does not exit VI

: w! Force save, do not exit VI

: Wq save file and Exit VI

: wq! Force the file to be saved and exit VI

: Q Do not save file, Exit VI

: q! do not save file, Force exit VI

: e! Discard all modifications
Finally, using Xshell to log in to the virtual machine is OK.



A dream ...


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.