Home  >  Article  >  System Tutorial  >  How to solve the problem of accidentally deleting the /root directory in CentOS?

How to solve the problem of accidentally deleting the /root directory in CentOS?

王林
王林forward
2024-01-07 16:06:56894browse

During testing, I accidentally deleted centos/root using rm -rf

Delete the /root directory, the system will not crash, and it can start normally, but it just looks unpleasant!

Solution:

1. Create the /root directory directly; mkdir /root

2. Copy the hidden files under /etc/skel/ to the /root directory; cp /etc/skel/.bash* /root

3. Restart

4. Be careful when using rm -rf in the production environment. It is best to test it in the test environment to make sure there are no problems before using it! ! !

The above is the detailed content of How to solve the problem of accidentally deleting the /root directory in CentOS?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete