Basic configuration of newly installed ubuntu and basic configuration of ubuntu

Source: Internet
Author: User
Tags reverse dns ssh secure shell ssh server

Basic configuration of newly installed ubuntu and basic configuration of ubuntu

1. Enable the root account

1. Set a password for the root user.

Sudo passwd root

2. Switch to root Login

Su root

3. Enable login and edit Configuration

Sudo vi/usr/share/lightdm. conf. d/50-ubuntu.conf

# Automatically log on as root after startup

1 autologin-user=root2 greeter-session=unity-greeter3 user-session=ubuntu

# Manually enter the user name and password used to log on to the system

Greeter-show-manual-login = true

# Disabling a guest user

Allow-guest = false

4. Disable the root account again.

Sudo passwd-l root

Sudo passwd root is used to set the password of the root user to enable the root account. The account to be locked is sudo passwd-l, and the account to be opened is sudo passwd-u (it must be locked before, otherwise it is invalid ).

 

Ii. Enable the ssh service

Determine whether to install the ssh service

Ssh localhost

Ssh: connect to host localhost port 22: Connection refused as shown above, indicating that no installation has been performed.

1. First update the source

Sudo apt-get update

2. Install the ssh service

Sudo apt-get install openssh-server

3. Check whether startup is enabled

Ps-e | grep ssh

If ssh is displayed, it indicates that it has been started. If not, it will be manually started.

Sudo/etc/init. d/ssh start

4. Configure ssh-server. The configuration file is located in/etc/ssh/sshd_config. The default port is 22. For security purposes, it is generally customized as another port and then restarted.

Sudo/etc/init. d/ssh restart

Use putty or SSH Secure Shell to log on to windows.

 

3. Allow Remote root Login

Sudo vi/etc/ssh/sshd_config

Find PermitRootLogin without-password and change it to PermitRootLogin yes

Sudo/etc/init. d/ssh restart

Restart the ssh service

 

Appendix: SSH configuration file

By default, the configuration file of the sshd service is in/etc/ssh/sshd_config. Correct configuration items can further improve the security of sshd remote logon.

The configuration file content can be divided into the following three parts:

(1) Common SSH server listening options are as follows:

Port 22 // The listening Port is 22

Protocol 2 // use the SSH V2 Protocol

ListenAdderss 0.0.0.0 // The listening address is all addresses

UseDNS no // disable reverse DNS resolution

(2) Common User Logon control options are as follows:

PermitRootLogin no // disable root user logon

PermitEmptyPasswords no // disable empty password User Login

LoginGraceTime 2 m // login verification time is 2 minutes

MaxAuthTries 6 // The maximum number of retries is 6

AllowUsers user // only allow the user to log on, opposite to the DenyUsers Option

(3) Common Logon verification methods are as follows:

PasswordAuthentication yes // enable password verification

PubkeyAuthentication yes // enable key verification

AuthorsizedKeysFile. ssh/authorized_keys // specify the public key database file

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.