It is possible on Linux to change the administrator password whether or not you have the current one. It's very easy with the Command Prompt.
Steps
Method 1 of 2: With the administrator password

Step 1. Run a command prompt window (Terminal)
Use the keyboard combination Control + Alt + T. This combination allows most Linux distributions to open the command prompt.
If your Linux computer doesn’t run with a Desktop, you don’t need to do anything, you’re already at the command prompt

Step 2. Type su in the command prompt
Confirm with the Enter key. The line UNIX password (current): then appears in the command prompt.

Step 3. Type the current administrator password
Confirm with the Enter key. If the password is correct, you will remain on the command prompt with administrator status.
- If you made a mistake while typing, retype su, then start over.
- A password is always case sensitive.

Step 4. Type passwd, then validate with the Enter key
A line
Enter the new UNIX password: appears under the previous one.

Step 5. Type a new password
Then validate with the Enter key. The password for security reasons does not appear on the screen.

Step 6. Retype the password, then validate with Enter
If all went well, will be displayed the password has been updated successfully.

Step 7. Type exit, then validate with the Enter key
You are now logged out of your administrator account.
Method 2 of 2: Without the administrator password

Step 1. Restart your computer

Step 2. From the Grub menu, press E
Grub runs when your computer starts up and it only stays on the screen for a few seconds.
- If you don't press the E key before the Grub menu disappears, restart … and be faster.
- This method works on most major Linux distributions (Ubuntu, CentOS 7, Debian). Now if you have an exotic linux distro understand rare you might not be able to switch to single user mode. If so, go to the designer's site to learn more.

Step 3. Move the cursor down to the linux / boot line
To do this, use the arrows ↑ and ↓ on your keyboard. It is on this line that the change will be made which allows you to restart in single user mode.
-
With CentOS and a few other distributions, the line will start with
linux16, while for other distributions it will be through linux.

Step 4. Move the cursor to the end of the line
To do this, use the navigation arrows on your keyboard: →, ←, ↑ and ↓. The cursor must be after
ro.

Step 5. After ro, type init = / bin / bash
The line that ended in
ro
now ends with:
ro init = / bin / bash
.
- Be careful to leave a space between
ro
andinit = / bin / bash
.

Step 6. Press Control + X
This combination allows you to reboot directly in single user mode with administrator account privileges.

Step 7. Type mount –o remount, rw / in the prompt
Then validate with the Enter key. This command mounts the system file in read and write mode.

Step 8. Type passwd, then validate with the Enter key
Single-user startup automatically gives you full administrator privileges, so you don't have to do any other settings.

Step 9. Type a new administrator password
Then validate with the Enter key. The password for security reasons does not appear on the screen.

Step 10. Retype the new password
Then validate with the Enter key. If the two password entries are the same, you will see the password has been updated successfully.

Step 11. Type reboot –f, then validate with the Enter key
This command allows a classic restart of your computer.
Advice
- A good password should be at least 8 characters long, a subtle mix of letters (upper and lower case), numbers and special characters like @, # or &, etc.
-
To change the password for a single user, type su, then
passwd.