Configure and use SSH in Ubuntu 10.10

Source: Internet
Author: User
Tags ftp client filezilla free ssh openssh server ssh secure shell ssh server ubuntu ssh server

 

Configure and use SSH in Ubuntu 10.10

I just installed something on Ubuntu 10.10. The installation steps are all obtained from the Internet, but I have tried it myself. Just record it for myself. In view of Java's performance on windows, I decided to switch to Ubuntu 10.10 to learn Zippy's hjpetstore.

This article describes how to configure and use SSH.

1. Install the SSH server.

Because ubuntu 10.10 comes with an SSH client, you do not need to install it. Server installation is simple:

Sudo apt-Get install OpenSSH-Server

After installation, the service starts.

2. Use a client to access the Ubuntu SSH Server

SSH client: Install the SSH client in windows. Chinese characters are garbled when accessing the Ubuntu SSH server. The reason is that the character set encoding in the Ubuntu Chinese environment is utf8, but the SSC encoding is set, because there is no utf8, the SSC parameter cannot be modified to achieve the purpose of display.

Putty: You can use putty in windows, but you need to modify the putty configuration. For details, refer to the alternative solution of SSH Secure Shell client, which is the same as putty in English:

 

 

3. FTP Client

You can use filezilla client to access the server from windows with SFTP without any Chinese garbled characters.

For more information, see install filezilla on Ubuntu 10.04 to download information from ftp idc.com FTP.

Alternative to SSH Secure Shell Client

SSH Secure Shell client is always used. This software is a free SSH remote logon software. Disadvantage is the use of local encoding, such as Windows is GBK, then login is connected through GBK, so if the server encoding is UTF-8, will produce Chinese garbled, such:

 

It is troublesome to read Chinese information. Because more and more software or class libraries are using generic UTF-8 encoding.

Currently, Putty is used as an alternative:

This tool is open-source and free of charge. Although it is simpler than the SSH Secure Shell client, it supports encoding and is very small and can be used at any time on a USB flash drive.

If no encoding is set, the default value is the local system encoding, Which is gb18030 in Vista. The setting interface is as follows:

After setting, you can display the UTF-8 encoded Chinese information:

In addition, the SSH Secure Shell client supports graphical SFTP for file upload and download. This function is quite useful. Putty only provides a command line SFTP client.

You can use another tool to implement graphical SFTP, such as filezilla ,:

Http://filezilla-project.org/download.php? Type = client

Download the client. filezilla also provides the FTP server. You can download the green version or the officially recommended Windows Installation version. Of the tool:

 

 

 

 

Enable SSH to check whether there are/etc/ssh/sshd_config files 1, CAT/etc/ssh/sshd_config, if yes: 2,/etc/init. d/ssh restart: 3. APT-Get Update (upgrade) 4. APT-Get Install SSH 5 and Y

 

 

There are many articles on enabling the SSH service in Ubuntu on the Internet, but most of the methods described are not ideal after testing, and remote login to Ubuntu is not possible, the reason is that the ssh-Server service is not enabled. The final success method is as follows:

 

Installing OpenSSH server in Ubuntu is very easy. Only one command is required:

Sudo apt-getinstall openssh-Server

 

(View the returned results. If no error occurs, use the SSH client software such as putty, securecrt, and SSH Secure Shell client to enter the IP address of your server. If everything is normal, you can connect later. And you can log on with the existing user name and password .)

 

Then confirm whether sshserver has started: (or use the "netstat-TLP" command)

 

PS-E | grepssh

 

If only SSH-agent is available, the ssh-server has not been started./etc/init. d/ssh start is required. If you see sshd, the ssh-server has been started.

 

The SSH-server configuration file is located in/etc/ssh/sshd_config. Here, you can define the SSH service port. The default port is 22. You can define other port numbers, such as 222. Then restart the SSH service:

 

Sudo/etc/init. d/ssh resart

 

In fact, if you have no special requirements, you can install OpenSSH server here. However, further setting can shorten the OpenSSH logon time and improve security. All of this is implemented by modifying the OpenSSH configuration file sshd_config.

First, you may find that it takes a long time to prompt you to enter the password after entering the user name. In fact, this is because sshd needs to reverse query the DNS information of the client. We can disable this feature to greatly increase the logon speed. First, open the sshd_config file:

Sudo nano/etc/ssh/sshd_config

Find the gssapioptions section and comment out the following two lines:

# Gssapiauthenticationyes # gssapidelegatecredentials no and restart the SSH service:

Sudo/etc/init. d/ssh restart

Try again. It should be very fast.

Use Putty to log on to the server through certificate authentication

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 to enable the certificate authentication option:

Rsaauthenticationyes pubkeyauthentication Yes authorizedkeysfile % H/. Ssh/authorized_keys after modification, restart the SSH service.

Next, we need to create a private key and a public key for the SSH user. First, you need to log on to the account that requires key establishment. Here, you must exit the root user. If necessary, use the su command to switch to another user. Then run:

Ssh-keygen

Here, we can store the generated key in the default directory. The passphrase will be prompted During the creation process, which is equivalent to adding a password to the certificate, which is also a measure to improve security, so even if the certificate is accidentally copied away, It is not afraid. Of course, if this field is left blank, Putty will automatically log on to the system after passing the certificate authentication.

The SSH-keygen command generates two keys. First, we need to rename the public key to the server:

Cd ~ /. Ssh mvid_rsa.pub authorized_keys, copy the private key id_rsa from the server, and delete the id_rsa file on the server.

The settings on the server are complete. The following steps need to be done on the client computer. First, we need to convert the id_rsa file to the format supported by putty. Here we need to use the puttygen tool:

Click the Load button on the puttygen interface, select the id_rsa file, enter passphrase (if any), and then click Save privatekey. The private key accepted by Putty is ready.

Open putty, enter the Server IP address in the session, click the Browse button under connection-> ssh-> auth, and select the generated private key. Return to the connection option and enter the User Name of the certificate in auto-login username. Return to the session tab and enter a name to save the session. Click open at the bottom to log on to the server through certificate authentication. If passphrase exists, passphrase is required during the logon process. Otherwise, it is very convenient to log on directly to the server.

 

Remotely log on to the Ubuntu server by using Ubuntu SSH on Windows and download putty.

How to copy files/folders on Windows and download filezilla from/to a remote Ubuntu Machine

 

 

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.