Install and configure SSHServer on Ubuntu Server

Source: Internet
Author: User
Tags openssh server
Before installation, Ubuntu is easy to use because it inherits the debian apt system. We believe you have learned this in the installation system tutorial. However, apt depends on the network. The system we installed yesterday cannot be connected to the network for the time being. We need to set it up first. First, activate the NIC of the server. The command is as follows: sudonano/etc/network/interfaces Add the following content to interfaces:

Preparations before installation

Ubuntu is easy to use because it inherits debian's apt system. We believe you have learned this in the installation system tutorial. However, apt depends on the network. The system we installed yesterday cannot be connected to the network for the time being. We need to set it up first.

First, activate the NIC of the server. The command is as follows:

Sudo nano/etc/network/interfaces

Add the following content to interfaces:

Auto eth0 iface eth0 inet static address 202.113.235.181 netmask 255.255.255.0 gateway 202.113.235.1 here, the IP address marked in the Italic part is the setting of our server. You need to modify it according to your actual situation. Of course, if your server uses DHCP to allocate IP addresses, you only need to write iface eth0 inet dhcp. You do not need to set address/netmask/gateway.

Then, modify resolv. conf to configure the DNS server:

Sudo nano/etc/resolv. conf

Add your DNS server address:

After nameserver 202.113.16.10 nameserver 202.113.16.11 is complete, restart the networking service:

Sudo/etc/init. d/networking restart

In this way, the network can be connected. If you are using ADSL, you may need to install pppoe and other things. Considering that the server rarely uses such a configuration, we will not discuss it here. If you need it, you can find it online.

Install and set OpenSSH Server

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

Sudo apt-get install openssh-server

Later, Ubuntu automatically downloads and installs openssh server, and resolves all dependencies. After completing this operation, you can find another computer and then use an SSH client (PuTTy is strongly recommended) to enter the IP address of your server. If everything is normal, you can connect later. You can log on with the existing user name and password.

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.

Related Article

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.