Set SSH in Ubuntu

Source: Internet
Author: User
Tags filezilla openssh server ssh secure shell

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-Get install 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 | grep SSH

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 gssapi options section and comment out the following two lines:
# Gssapiauthentication yes # 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:
Rsaauthentication Yes pubkeyauthentication Yes authorizedkeysfile % H/. Ssh/authorized_keys after modification is completed, 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 MV id_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

Material Source:

Http://mxsfengg.javaeye.com/blog/543000

Http://www.hackbase.com/tech/2009-03-22/51769.html

Filezilla uses SSH key authentication to connect to SFTP

00:00:00 View Original

Filezilla uses Putty to connect to the SFTP server. so if you want to use SSH key in filezilla, add your private key in default settings> ssh-> auth of putty. save it.

If the generated SSH key has passphrase, add passphrase to the password input box of filezilla.

Category: Java Development

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.