environment
- ubuntu system
abnormal
- The /home/ubuntu directory was deleted due to misoperation
solution
1. Create a new user
sudo adduser ubuntu1
2. Modify the directory name ubuntu1 to your deleted main directory name (mine is ubuntu)
sudo mv ubuntu1 ubuntu
3. Change the user and group to which it belongs
sudo chown -R ubuntu:ubuntu ubuntu
4. Change to default permissions
sudo chmod 700 /home/ubuntu
5. Make the commands in .bashrc take effect
source ~/.bashrc
6. Delete the ubuntu1 user just created
sudo deluser ubuntu1