current position:Home>Linux operating system Yum installation, uninstall and forget how to modify the root password

Linux operating system Yum installation, uninstall and forget how to modify the root password

2022-01-26 21:51:51 Bo childe

kali forget root How to change the password ?

First step : Select restart client

The second step : Just press the keyboard   E Enter edit mode

The third step : hold ro Change to rw, Delete quiet splash, Add after init=/bin/bash

Step four : Then press ctrl+x Exit the current interface , To the interface shown in the figure below

Step five : If there's no back [email protected](none):/#, Just press enter a few times

Step six : Then input passwd, Reset new password , Entering the password will not show

Step seven : After resetting the password , restart

Step eight : After restart , The login number is root, The password is the password you just reset

CentOS_7 forget root How to change the password ?

First step : open centos7, Press... In the interface of entering the system “e” Go to the edit page .

Some have only two lines , Just choose the first line .

The second step : Find out “Linux16” Beginning line , Enter... At the end of the line “init=/bin/sh”

The third step :Ctrl+X   Enter single user mode

Step four : Input “mount -o remount rw /”( Be careful mount And -o Between and rw And / There are spaces between )

Step five : Input “passwd” enter

The next step is to modify your root Account password ,( The password is not displayed when it is entered , It looks like there's no reaction , Just input it correctly and enter it

Step six :

Input touch /.autorelabel, enter

Input exec /sbin/init enter

After entering, the following interface appears , Wait here for a few minutes , The system will restart automatically

Next, wait for the system to restart and then enter to see if the modification is successful .

CentOS7、kali Update software source

CentOS7 to update yum The source is alicloud

(1) First backup /etc/yum.repos.d/CentOS-Base.repo

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

(2) Get into yum The folder where the source configuration file is located

cd /etc/yum.repos.d/

(3) download 163 Or Alibaba cloud yum Source configuration file , Put in /etc/yum.repos.d/( Please make corresponding backup before operation , I installed. CentOS7)

163:wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

CentOS7:wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

(4) function yum makecache Generate cache

yum makecache

(5) Update system

yum -y update

yum repolist enabled        View enabled yum Source

yum repolist all                        be-all yum Source

kali to update yum Source

First look at kali Files in source , There is an official source by default .(vim /etc/apt/sources.list)

Then add the domestic sources we found , Annotate the official source .( Add... To the front “#”). The following are domestic and foreign sources .

# kali Official source  
deb http://http.kali.org/ moto main non-free contrib 
deb-src http://http.kali.org/ moto main non-free contrib
deb http://security.kali.org/ moto/updates main contrib non-free 
deb-src http://security.kali.org/ moto/updates main contrib non-free
# China University of science and technology kali Source  
deb http://mirrors.ustc.edu.cn/kali kali main non-free contrib 
deb-src http://mirrors.ustc.edu.cn/kali kali main non-free contrib 
deb http://mirrors.ustc.edu.cn/kali-security kali/updates main contrib non-free
# Singapore kali Source 
 deb http://mirror.nus.edu.sg/kali/kali/ kali main non-free contrib 
 deb-src http://mirror.nus.edu.sg/kali/kali/ kali main non-free contrib 
 deb http://security.kali.org/kali-security kali/updates main contrib non-free 
 deb http://mirror.nus.edu.sg/kali/kali-security kali/updates main contrib non-free 
 deb-src http://mirror.nus.edu.sg/kali/kali-security kali/updates main contrib non-free
# Alibaba cloud kali Source  
deb http://mirrors.aliyun.com/kali kali main non-free contrib 
deb-src http://mirrors.aliyun.com/kali kali main non-free contrib 
deb http://mirrors.aliyun.com/kali-security kali/updates main contrib non-free
#163 Kali Source  
deb http://mirrors.163.com/debian wheezy main non-free contrib 
deb-src http://mirrors.163.com/debian wheezy main non-free contrib 
deb http://mirrors.163.com/debian wheezy-proposed-updates main non-free contrib 
deb-src http://mirrors.163.com/debian wheezy-proposed-updates main non-free contrib 
deb-src http://mirrors.163.com/debian-security wheezy/updates main non-free contrib 
deb http://mirrors.163.com/debian-security wheezy/updates main non-free contrib
# China University of science and technology  
deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib 
deb-src http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
# Zhejiang University  
deb http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free 
deb-src http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
# Neusoft University  
deb http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib 
deb-src http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
# Tsinghua University  
deb http://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free 
deb-src https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free

The picture below is my own kali linux Source in use in .

  There are several commands that will be used in the update source .

apt-get update: Update source list . If you modify the source list or want to refresh synchronously or add a new source , You should execute the above command .

apt-get upgrade: This command will attempt to download in apt All updated software packages are available on the server , Then press “y” When you install them .

apt-get dist-upgrade: This command also updates all software packages . But when upgrade update , If the dependency cannot be resolved, it may report an error or abort , But dist-upgrade The command automatically resolves dependencies . therefore dist-upgrade Software that you don't want to update may be updated , As a result, some software that needs to rely on old packages cannot run .

therefore ,apt-get dist-upgrade Use with caution . Usually use apt-get update && apt-get upgrade It can ensure the integrity of the system .

Then clean up .apt-get clean

Restart it .reboot

yum Uninstall and install software

One 、yum brief introduction

Yum( Its full name is Yellow dog Updater, Modified) It's a Fedora and RedHat as well as CentOS Medium Shell Front end package manager . be based on RPM Package management , Can be automatically downloaded from the specified server RPM Package and install , Dependency relationships can be handled automatically , And install all the dependent packages at once , No need to download it over and over again 、 install .

Two 、 frequently-used yum command

1、 Show installed packages (yum list installed)

 2、 Find packages that can be installed ( With tomcat For example )(yum list tomcat)

 3、 Install package ( With tomcat For example )(yum install tomcat)

 4、 Uninstall package ( With tomcat For example )(yum remove tomcat)

 5、 List the dependencies of the package ( With tomcat For example )(yum deplist tomcat)

 6、-y Auto answer yes

When you install the software , There will be interruptions , Let the user choose whether to continue , Here's the picture :

We can use -y To answer all yes , For example, we install tomcat When , Use the following command , Complete the installation task at one go , It won't stop .

yum -y install tomcat

7、info Displays the description and summary of the package

With tomcat For example (yum info tomcat)

 8、 Upgrade package

Upgrade all packages (yum update)

Upgrade a package , To upgrade tomcat For example (yum update tomcat)

Check for updatable programs (yum check-update)

Check the installation (rpm -qi firefox)

Basic network troubleshooting

1. The three step Ping Law
You should first understand the user or think about what you have done recently , Then take three steps Ping Law , Usually find the culprit .

  • First step : First enter command line mode , adopt “ping 127.0.0.1” To judge TCP/IP Whether the protocol was successfully installed , If not, reinstall TCP/IP agreement , If the general rule goes to the next step .
  • The second step : Input “ipconfig” Get the machine IP Address and gateway address , adopt “ping This machine IP Address ” To determine whether there is a problem with the network card , If Ping no , You need to reinstall the network card driver , If the general rule goes to the next step .
  • The third step : Through the first two steps, it can be judged that the local network protocol and network card are working normally , The problem is the network cable , It's still on the remote server or router link . perform “ping gateway IP Address ”, If it doesn't work, the problem basically lies in the network cable , You should check RJ45 Whether the wire on the crystal head is broken , Or change a network cable to test , If the general rule indicates that the remote link connection from the local computer to the server or router is normal , The problem is the settings on the server or router , It has nothing to do with this machine .

2. Break one by one

(1) Software reasons

You may be unable to access the network due to the installation of some software , This kind of software is mainly network agent software , If you can't solve the problem by trying the above methods , Check to see if there is such software in the list of installed software , If so, consider uninstalling .

(2) Hardware reasons

  • First step : Check whether the indicator of the network card is flashing or always on , Because the status display modes of various network card indicators are different , If the red light or status indicator is not on, it does not necessarily mean that there is a fault , Some network cards only flash when sending packets ( In the early ISA It is common on the network card ), Therefore, simply observing the status light can not determine that the problem lies in the hardware , Further testing is needed . use Ping Command test , If the indicator is always off during command execution , It can be preliminarily determined that it is a hardware problem .
  • The second step : Check the cable , Unplug the network cable connector from the network card and information socket , Plug in the two sockets of the line measuring device , Turn on the line tester switch , If you see left and right 8 The two indicators flash in sequence , It indicates that the network cable communication is normal , If one of the indicators doesn't light up , It indicates that there is a problem with the network cable , It needs to be replaced .

linux System network troubleshooting process

  • 1.ifconfig  see ip Is there a problem
  • 2.ping 127.0.0.1  Test the local network loop for problems
  • 3.mii-tool eth0   Check whether the physical connection of the network card is normal
  • 4.ping 192.168.0.1  ping The gateway tests whether the network connection is normal
  • 5.tracepath 8.8.8.8  track dns
  • 6.tracepath [ Website domain name ] Track whether the external connection is normal
  • 7.nslookup [ Website domain name ]  View the network connection path
  • 8.Telnet [ Website domain name ] 80  Check the network connection port

Copy, paste and move files

One 、 File copy command cp

Command format :cp Source file Target file

Parameter description :

  • -f: mandatory (force), If there is any repetition or other question , Don't ask users , And forced copying
  • -r: Recursive replication , For directory copy operations

Copy file /mut/aaa To /etc/ Under the table of contents :cp /mut/aaa /etc/

Copy directory to /etc/ Under the table of contents :cp -r /mut/log/ etc

Two 、 file move 、 Rename command mv

Command format :mv [-fiu] Source file Target file

Parameter description :

  • -f:force, Force to move directly without asking
  • -u: If the target file already exists , And the source file is relatively new , Will update

Such as the /test1 In the catalog file1 Copied to the /test3 Catalog , And change the file name to file2, You can enter the following command :

mv /test1/file1 /test3/file2

File rename

Command format :mv File name to be modified Modified file name

3、 ... and 、 File delete command rm

Command format :rm [-fir] File or directory

Parameter description :

-f: Mandatory deletion

-i: Interactive mode , Ask the user whether to operate before deleting

-r: Recursive delete , It is often used in the deletion of a directory

Create user

useradd user name

Delete user

userdel user name

Create user group

groupadd User group name

Delete user group

groupdel User group name

To view the user

  • cd /home/
  • ls

Change user password

passwd user name

copyright notice
author[Bo childe],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/01/202201262151493219.html

Random recommended