Ubuntu Learning History 1

Source: Internet
Author: User

1.: View version information of Ubuntu system

Cat/proc/version

Uname-a

Sb_release-a


2. Modify the IP address

cat/etc/network/interfaces# Interfaces (5) file used by Ifup (8) and Ifdown (8) Auto loiface lo inet loopbackauto enp0s8 IFA Ce enp0s8 inet staticaddress 192.168.56.80netmask 255.255.255.0

Systemctl Restart Networking #重启网络

Ifconfig enp0s8 192.168.56.80 netmask 255.255.255.0 #马上生效


3, ubuntu16 switch off the graphical interface to start

Systemctl Disable Lightdm.service #关闭图形界面

Ln-s/lib/systemd/system/lightdm.service/etc/systemd/system/display-manager.service #开启图形界面命令

Reboot


4. Install the Package

Apt-get Install Vim

Apt-get Install Openssh-server


Systemctl start sshd


5. Set host name

Hostnamectl Set-hostname server.name01

Cat/etc/hosts

Cat/etc/hostname

Hostname


6. Ubuntu forgot root password:

Start ESC

1. Press ENTER to enter the following interface, then select the option with Recovery mode

2, press E to enter the following interface, find the picture of the red box recovery Nomodeset and delete it

3. Then enter quiet Splash RW in the back of this line Init=/bin/bash

4, then press F10 after the appearance of the following interface, in the command line input passwd after the change password can be

5, this method can also be used to repair files

6, the root of Ubuntu can set the password, but cannot telnet



7, Ubuntu sudo file corruption:

Root users directly modify the corresponding sudoers file directly to the correct file, such as deleted directly from other places to copy a blank on the line

When the root user cannot be used, it can be modified in the system's repair mode; Enter the Repair mode method

Press ESC when rebooting (boot) (this will enter grub mode)

Select Repair Mode

Select Remove Root mode

Re-mount/directory, do not operate the sudoers after the permissions, re-mount Get permissions

Mount-o REMOUNT,RW/


Edit Sudoers file to correct

Reboot restart System

The right way to edit

Do not edit the sudoers file directly

The system provides the Visudo tool to edit the sudoers file, which has the ability to check for errors, effectively avoiding permissions problems and grammatical problems


9. sudo password-free

XXX all= (all:all) Nopasswd:all

%sudo all= (All:all) Nopasswd:all


10. The difference between sudo and Su

sudo: temporarily switch to Superuser mode to perform superuser privileges, prompting for a password that is the current user's password, not the password for the super account. However there is a time limit, Ubuntu defaults to 15 minutes for one time.

SU: Switch to a certain user mode, prompted to enter the password when the password is Switched account password, the use of "SU account name." If the system defaults to the root account when no account is added, the password is also the password for the super account. There is no time limit.

Sudo-i: You can use this command to frequently perform certain permissions that only the superuser can perform, without having to enter the password each time. When prompted for a password, the password is the password for the current account. There is no time limit. After executing the command, the prompt changes to "#" instead of "$". You can perform "exit" or "logout" when you want to return a regular account.



Sudo-i directly run the sudo command plus-i parameter

sudo su runs the sudo command to give the SU command a right to run the SU command.

Sudo-i Running Results pwd=/root

sudo su run result pwd=/home/user name (current user home directory)


Ubuntu Learning History 1

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.