Install, start, and uninstall ssh under Ubuntu

Source: Internet
Author: User
Tags ssh port

 install, start, and uninstall ssh under Ubuntu1. First stop SSH service: sudo stop ssh
2. Uninstall Openssh-server:apt-get Remove Openssh-server
3. Uninstall Openssh-client:apt-get Remove Openssh-server
4, installation Openssh-server:apt-get install Openssh-server
5, installation Openssh-client:apt-get install Openssh-client
6. After the installation is complete, start the service: Sudo/etc/init.d/ssh start

7. After starting, check whether the service starts correctly: Ps-e|grep SSH

8. Confirm that Ssh-server is working properly: NETSTAT-TLP

2. Generate keySsh-keygenThe middle procedure will prompt you to place the key where you enter the file in which to save the key (/HOME/GAVIN/.SSH/ID_RSA): Select the default directory, go directly to it, and then prompt for enter passphrase (empty F or no passphrase): Set a password to enter the private key, in the back of the import Id_rsa to Puttygen will be used, casually set a good (but to remember); the above process will generate two files, one is Id_rsa (private key), one is id_ Rsa.pub (public key); Here, rename the public key to Authorized_keys:CD. SSHMV Id_rsa.pub Authorized_keys3, modify the configuration file,/etc/ssh/sshd_configsudo vi/etc/ssh/sshd_configThere is such a line # Authorizedkeysfile%h/.ssh/authorized_keys, the front of the # can be removed;

Ubuntu does not have the default SSH service installed, if you link ubuntu via SSH, you need to manually install Ssh-server. To determine if the SSH service is installed, you can do this by:

$ ssh localhost

Ssh:connect to host localhost Port 22:connection refused

As shown above, it means that no installation has yet been installed and can be installed via apt, with the following commands:

$ sudo apt-get install Openssh-server

The system will be installed automatically, after the installation is complete, start the service first:

$ sudo/etc/init.d/ssh Start

After you start, you can see if the service starts correctly with the following command

$ ps-e|grep SSH

6212? XX: +sshd

The above indicates the start OK. Note that the default SSH port is 22, you can change the port, stop before changing,

And then start is ready. The configuration is configured under/etc/ssh/sshd_config, as shown below.

$ vi/etc/ssh/sshd_config

# Package generated configuration file

# See the sshd (8) manpage for details

# What ports, IPs and protocols we listen for

Port

Finally, it should be the time to connect. Take a look at the following command:

$ ssh Exceljava@192.168. 158.129

To start, stop, and restart SSH:

Sudo/etc/init.d/ssh start

Sudo/etc/init.d/ssh stop

Sudo/etc/init.d/ssh restart

Or

sudo start ssh

sudo stop ssh

sudo restart SSH

Uninstalling SSH

First stop the SSH service: sudo stop ssh

Then: $ sudo apt-get–purge remove openssh-server

How to use SSH to Telnet to Ubuntu under Windows

To the Windows platform, the previously generated private key Id_rsa, converted to the format recognized by Putty (*.PPK), to get the file ID_RSA.PPK. (1) Copy the ID_RSA generated on Linux to the Windows platform ; (2) Download Puttygen.exe, (: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) and open it, we're going to let it make a pass for us, generate id_ RSA.PPK; (3) Select "Load" to load to save the private key file: a) The popup dialog box "file type" to "All Files" and then select the Id_rsa file we generated from the Ubuntu server, B) then it will prompt you to enter the password, This is not your Linux user password, but the password generated before the key, C) and then click on "Save private Key", note (format is *.PPK) because Putty only recognize their own keys;

5. Start putty on Windows, configure the following (1) Session-logging-hostname: Fill in your Linux IP (2) windows-translation-select UTF-8 in the drop-down menu, not set here, There will be garbled characters in Chinese after login. (3) Connection-data-auto login Username: Fill in the username you used to sign in to Ubuntu. (4) Connection-ssh-auth-private key file for authentication: Select ID_RSA.PPK, then click Open, follow the prompts to enter the password to access.

Reprint to:

http://blog.csdn.net/swuteresa/article/details/9377169

Http://blog.sina.com.cn/s/blog_7d892a6701016hmo.html

Install, start, and uninstall ssh under 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.