An attempt to ssh the connection in the LAN

Source: Internet
Author: User
Tags ssh server

Recently got a secondhand hp notebook. Sell my book is think very beautiful costume designer, she because have a new Mac Ben so HP was idle, then sold to me. The performance of the book is similar to my own Samsung, in addition to the battery is not too powerful, each boot will prompt 601.
I also have a wireless router. Both computers are fitted with ubuntu14.04 64-bit systems. So I want to open a LAN through the wireless router to SSH connection between the two computers.
First try ssh localhost
$ ssh localhostssh:connect to host localhost Port 22:connection refused
Running the following command generates a bunch of keys id_rsa and id_rsa.pub in the ~/.ssh/directory:
$ ssh-keygen
To enter the following prompt information, the key pair will be generated in the default location ~/.ssh/directory, and we set passphrase to empty, that is, no password login.
Use the following command to join the newly generated public key to the authorized key list file Authorized_keys (because there is no Authorized_keys file at the beginning, so use the CP command here):
$CP ~/.ssh/id_isa.pub ~/.ssh/authorized_keys

Make sure that the. SSH directory and the Authorized_keys file have only the user's own Write permission, otherwise the validation is not valid
$ CHOMD ~/.ssh/authorized_keys
$ chmod ~/.ssh
However, it is still not possible to SSH to localhost because Ubuntu does not have an SSH server installed and opened by default, so we also need to:
1. Determine the installation of sshd
$ sudo apt-get install Openssh-server
2. Start sshd
$ sudo net start sshd
3. Check the firewall settings and turn off the firewall
$ sudo nfw disable
4. Verify the success, run the following command
$ ssh localhost
Sometimes although successful, but still will appear connection refused problem, this is, need to check whether the sshd process is started.
Run the following command to see if there is an sshd process:
$ PS-E | grep ssh
Sometimes although you can see the sshd, but still cannot connect successfully, this is the need to restart SSH:
$ sudo service ssh restart
Then connect again.

Samsung computers and HP computers are connected to the LAN, the Samsung computer's intranet IP for the 192.168.1.101,HP computer's intranet IP is 192.168.1.102, add the contents of the id_rsa.pub of the Panjiang HP computer to the Samsung computer's Authorized_ In the keys, SSH to the Samsung computer using the following command on the HP computer:
$ ssh 192.168.1.101
Use Ctrl+d or exit or logout to exit the SSH connection.

An attempt to ssh the connection in the LAN

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.