By default, the SSH service is not installed on Ubuntu. If you connect to ubuntu through ssh, You need to manually Install ssh-server. To determine whether to install the ssh service, run the following command: www.linuxidc.com @ linuxidc :~ $ Sshlocalhostssh: connectto & nbs
Install the SSH service
By default, the ssh service is not installed in Ubuntu. If you connect to ubuntu through ssh, You need to manually Install ssh-server. To determine whether to install the ssh service, run the following command:
- Www.linuxidc.com @ linuxidc :~ $ Ssh localhost
- Ssh: connect to host localhost port 22: Connection refused
As shown above, it indicates that no installation is available. You can use apt to install it. The command is as follows:
- Www.linuxidc.com @ linuxidc :~ $ Sudo apt-get install openssh-server
The system will automatically install the service. After the installation is complete, start the service:
- Www.linuxidc.com @ linuxidc :~ $ Sudo/etc/init. d/ssh start
After the service is started, run the following command to check whether the service is correctly started:
- Www.linuxidc.com @ linuxidc :~ $ Ps-e | grep ssh
- 6212? 00:00:00 sshd
The preceding command indicates that OK is enabled. Note: The default ssh port is 22. You can change the port and stop it first,
Then start. Modify the configuration in/etc/ssh/sshd_config, as shown below.
- Www.linuxidc.com @ linuxidc :~ $ Vi/etc/ssh/sshd_config
- # Package generated configuration file
- # See the sshd (8) manpage for details
- # What ports, IPs and protocols we listen
- Port 22
Finally, it is time to connect. See the following command:
- Www.linuxidc.com @ linuxidc :~ $ Ssh exceljava@192.168.158.129.
Disconnect:
- Exit
Use Putty to log on to the VM
First, you must ensure that the virtual machine and the host can be pinged to each other. You can search for articles about virtual machine IP configuration on the Internet.
Next, open the Putty client, and enter relevant parameters in the following interface:
The IP address is the Ubuntu IP address in the VM.
Click Open to enter Putty, and enter the user name and password to log in.
Solve Chinese garbled characters
After logging in, run the ls command to view the root directory of the current user. garbled characters are displayed.