The ubantu server crashes, how to use the previous account after reinstalling the system

1. Enter the root account:
sudo su
2. Check the account owner and group
ls -la
insert image description here

2. Add the same existing account name to the current system:
adduser newusername
Note: Report an existing user name! Never mind, this error. has been added to the new system.

3. Modify permissions
Method 1: sudo vim /etc/sudoers file, find
insert image description here
and add: newusername ALL=(ALL) ALL

Note: Basically, vi can be divided into three states, which are command mode, insert mode and last line mode. The functions of each mode are distinguished as follows: 1) Command mode command mode) controls the movement of the screen cursor, deletes characters, words or lines, moves and copies a section and enters Insert mode, or enters last line
mode
  .
2) Insert mode (Insert mode)
Press the [Insert] key to enter the insert mode, and press the "ESC" key to return to the command line mode.
3) Enter a colon in the last line mode : Enter the wq! command
in the last line mode , save and exit. q! command, exit without saving.

4. Modify the owner and group of the directory

chown -R newusername:newusername /home/newusername/

At this point, check ls -la and the modification of the owner and group should be completed.
You should be fine to log in again.
5. The server refuses to update the software and installation package.
Otherwise, the ubantu server may not be able to open the desktop after updating the software.
add link description

Guess you like

Origin blog.csdn.net/weixin_44229976/article/details/127170458