Install and use SSH on Ubuntu 8.10

Source: Internet
Author: User
Tags openssh server scp command ssh server
Run the command on the terminal to test SSH localhost. If the following error occurs, it is probably because SSH-server: SSH: connect to host localhost port 22 is not installed: connection refusedubuntu SSH Server Setup 1) only one command is required to install OpenSSH server in OpenSSH serverubuntu: sudo apt-Get install OpenSSH-server, ubuntu automatically downloads and installs OpenSSH server, and resolves all dependencies. Start ssh-serversudo/etc/init. d/ssh start2). Further setting can shorten OpenSSH logon time and improve security. All of this is implemented by modifying the OpenSSH configuration file sshd_config. Open the sshd_config file: sudo gedit/etc/ssh/sshd_config find the gssapi options section and comment out the following two lines: (I installed SSH with the default annotations) # gssapiauthentication yes # gssapidelegatecredentials no and restart the SSH service: sudo/etc/init. d/ssh restart: Try again. It should be very fast. 3) Implement key-based SSH in Linux. In the SSH service, all content is encrypted and secure. However, if you can use the Certificate for authentication, the security will be further improved, and after some settings, you can also achieve the effect of automatic login for certificate authentication. First, modify the sshd_config file and enable the certificate authentication option: rsaauthentication yespubkeyauthentication yesauthorizedkeysfile % H/. Ssh/authorized_keys. Then Disable password authentication. # To enable empty passwords, change to Yes (not recommended)
Permitemptypasswords No

Restart the SSH service after modification. Sudo/etc/init. d/ssh restart next we need to create a private key and public key for the SSH user. First, log on to the client and run: SSH-keygen-t dsa-p'-f ~ /. When you create an SSH/id_dsa instance, you will be prompted to enter passphrase. This is equivalent to adding a password to the certificate, which is also a measure to improve security, so that even if the certificate is accidentally copied away, you are not afraid. The SSH-keygen command generates two keys, namely the private key id_rsa and the Public Key id_rsa.pub. Append id_dsa.pub to authorized_keys (the authorized_keys file is not available currently): $ cat ~ /. Ssh/id_dsa.pub> ~ /. Ssh/authorized_keys. After that, you can log on to the local machine without a password: $ SSH localhost. Below is the link between the two machines. First, we need to leave the private key on the client and use the SCP command to upload the public key to the server. SCP id_dsa.pub username1@192.168.0.3:/home will id_dsa.pub file to 192.168.0.3 host user name is username1 home. Run $ cat id_dsa.pub>. Ssh/authorized_keys on 192.168.0.3 and use username1. In this way, the client's public key is added to the server. Link the client to the server: SSH username1 @
192.168.0.3. You can add 192.168.0.3 to the client's/etc/hosts: 192.168.0.3 username1
In this way, you can use SSH username1 @
Username1
Host.

 

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.