- How to change the sudo password through command line on CentOS 8
- Step 1: Open Terminal
- Step 2: Log in as admin or root user
- Step 3. Change the sudo password using the passwd command
- Step 4: Log off or terminate the root terminal session
- Shortcut alternative
- Summary
- Как изменить пароль суперпользователя в Linux
- Если вы знаете пароль
- Если вы не знаете пароля
- Дополнительные статьи
- Об этой статье
- How to Change sudo Password in Ubuntu 22.04
- Step 1: Open the Ubuntu command line
- Step 2: Log in as root user
- Step 3: Change the sudo password through the passwd command
- Step 4: Exit the root login and then the Terminal
- An Alternative
- Search
- About This Site
- Latest Tutorials
- How to Change Sudo or Root Password in Ubuntu
- Change the Root Password in Ubuntu
- Option 1: Changing Ubuntu Password in the Command Line
- Option 2: Change sudo Password with the passwd Command
- Option 3: Changing Ubuntu Password Using GUI
How to change the sudo password through command line on CentOS 8
Most new Linux admin users of CentOS 8 do not know how to reset or change the sudo password from the command line environment. It is a good practice for security reasons to regularly change the password of each system user. This habit is important for superuser, who has special privileges to perform all sensitive tasks under CentOS 8. Only root or a superuser can change the password for any other user account. Normal users can only change their own passwords. A user’s password can be changed under CentOS 8 using the ‘passwd’ command.
This article demonstrates how a root user can change its own password on a CentOS 8.
The following steps are necessary to change the sudo password from the command line:
Step 1: Open Terminal
To change the sudo user password, you must first open the command line or terminal on your CentOS 8 system. To do this, you can either use the key combination “Ctrl + Alt + t” to open the terminal, or you can access it from the application launcher search bar as follows:
You can open the application launcher search bar by pressing the window key or superscript key on the keyboard.
Step 2: Log in as admin or root user
The root user can only change his own password. Therefore, log in as the root user on your CentOS 8 system. To do this, you need to type the following command in the terminal:
The system will prompt you to enter the password of your root account. Enter the password and press “Enter” to log in as the root user.
You have logged in as the root user on your CentOS 8 system. You can see this in the image above.
Step 3. Change the sudo password using the passwd command
Now that you have logged in as the root user, you can change the root account password by running the passwd command as follows:
After running the passwd command in the terminal, the system alerts you that you are changing the current root user password and prompts you to enter the new root user password. You enter the new password and press ‘Enter’, the system will prompt you again to enter the new password. Enter the above password again and press ‘Enter’. The terminal will display a confirmation message that all authentication tokens have been successfully updated, which means that the password has been successfully updated.
Now use the newly updated password for your root account in all software installations and file configuration operations that require root authorization.
Step 4: Log off or terminate the root terminal session
Now that you have changed the root password, you can log out of the root user prompt by entering the following command:
After running the above command, the logout status will be displayed on the terminal, which means that you have now been logged out or exited from the root account.
Shortcut alternative
There is another alternative to change the root user’s password. You use the following command on the terminal, through which you log in as the root user and enter the root account password. With a single command, you can change the root user’s password in this way.
After running the above command, a password change notification will appear on the terminal. Now enter the new password and press “Enter”. Enter the newly selected password again and press “Enter” again. After that, a message will appear that all authentication tokens have been successfully updated, which means that the root password has been changed.
Summary
In this article, you learned how to change the root account password using the terminal on CentOS 8. I hope that you are now able to change the password of your root user account, which will help you to protect your system from malicious activities. Please give us your feedback via the comments.
Как изменить пароль суперпользователя в Linux
В создании этой статьи участвовала наша опытная команда редакторов и исследователей, которые проверили ее на точность и полноту.
Команда контент-менеджеров wikiHow тщательно следит за работой редакторов, чтобы гарантировать соответствие каждой статьи нашим высоким стандартам качества.
Количество просмотров этой статьи: 25 685.
Из этой статьи вы узнаете, как в Linux изменить пароль суперпользователя, если вы знаете текущий пароль, и если вы его не знаете .
Если вы знаете пароль
- Если вы не пользуетесь средой рабочего стола, вы уже находитесь в терминале, поэтому перейдите к следующему шагу.
Введите su в терминале и нажмите ↵ Enter . [2] X Источник информации На следующей строке появится слово Password: (Пароль).
- Если вы ввели неверный пароль, введите su и повторите попытку.
- Пароли чувствительны к регистру.
Введите passwd и нажмите ↵ Enter . На новой строке появится Enter new UNIX password: (Введите новый пароль).
Введите новый пароль еще раз и нажмите ↵ Enter . Вы увидите сообщение «Password updated successfully» (Пароль успешно обновлен).
Если вы не знаете пароля
- Если вы не успели нажать E , и меню Grub исчезло с экрана, перезагрузите компьютер и попробуйте снова.
- Этот метод работает в большинстве популярных дистрибутивов Linux (Ubuntu, CentOS 7, Debian). Существует много дистрибутивов Linux, и если у вас не получается перейти в однопользовательский режим с помощью этого метода, почитайте инструкции к своему дистрибутиву (на сайте его разработчиков).
Переместите курсор в конец строки. Используйте клавиши → , ← , ↑ и ↓ , чтобы поместить курсор сразу после ro .
Нажмите Ctrl + X . Это сообщит системе о том, что в однопользовательском режиме нужно сразу открыть терминал с правами суперпользователя.
Введите mount –o remount,rw / в терминале и нажмите ↵ Enter . Это приведет к монтированию файловой системы в режиме чтение/запись.
Введите passwd в терминале и нажмите ↵ Enter . Так как в однопользовательском режиме вы автоматически получаете права суперпользователя, нет необходимости добавлять в эту команду дополнительные параметры.
Введите новый пароль суперпользователя и нажмите ↵ Enter . Вводимый пароль не будет отображаться на экране.
Введите новый пароль еще раз и нажмите ↵ Enter . Когда система подтвердит, что оба пароля совпадают, вы увидите сообщение «Password updated successfully» (Пароль успешно обновлен).
- Пароль должен включать не менее 8 символов и содержать сочетание букв (прописных и строчных), цифр и символов.
- Чтобы изменить пароль для другого пользователя, введите su , чтобы получить права суперпользователя, а затем введите passwd .
Дополнительные статьи
Об этой статье
В создании этой статьи участвовала наша опытная команда редакторов и исследователей, которые проверили ее на точность и полноту.
Команда контент-менеджеров wikiHow тщательно следит за работой редакторов, чтобы гарантировать соответствие каждой статьи нашим высоким стандартам качества. Количество просмотров этой статьи: 25 685.
How to Change sudo Password in Ubuntu 22.04
If you are a new Ubuntu admin user, you may want to know how to change the password in Ubuntu Linux Server from the bash shell or command line. After all, it is a good security practice to change passwords for every user, especially the SuperUser who can perform all sensitive operations in Ubuntu. Only a SuperUser or root can change the password for any user account. Other users can only change their own passwords.
User passwords are changed in Ubuntu using the passwd command.
In this article, we explain how a root user can change their own password on an Ubuntu server.
We have run the commands and procedures mentioned in this article on an Ubuntu 22.04 LTS system.
Need help in creating a strong password? Then take a look here: 7 Methods to Generate a Strong Password in Ubuntu
Step 1: Open the Ubuntu command line
We need to use the Ubuntu command line, the Terminal, in order to change the sudo password. Open the Terminal either through the system Dash or the Ctrl+Alt+T shortcut.
Step 2: Log in as root user
Only a root user can change his/her own password. Therefore you need to log in as root first. Enter the following command to do so:
The system will prompt you to enter the current sudo password. Please enter the password and hit Enter.
Now you will be logged in as root user; you can see that indication in the command prompt.
Step 3: Change the sudo password through the passwd command
Now that you are logged in as root, you can change the passwd for the current (root) user by using the passwd command as follows:
When you enter the passwd command, the system will prompt you to enter the new UNIX root password. When you enter the new password and hit enter, the system will prompt you to retype the new UNIX root password. After doing so, the system will confirm that the password is updated successfully.
Now whenever you need to log in as root or perform any installation and configuration operation that requires root authorization, you will be using this new password.
Step 4: Exit the root login and then the Terminal
When you are done with changing the password, you can log out of the root prompt by entering the following command.
Once you are logged out, type the exit command again to exit the Terminal application.
An Alternative
A simple alternative is to enter the following command that lets you log in as root and enter the password-changing command for root, in a single command:
When you enter the above command, the system will prompt you to enter the new UNIX root password. When you enter the new password and hit enter, the system will prompt you to retype the new UNIX root password. After doing so, the system will confirm that the password is updated successfully.
With the help of this article, you can change the password for sudo and make your system secure from any malicious activity time and again.
Search
About This Site
Vitux.com aims to become a Linux compendium with lots of unique and up to date tutorials.
Latest Tutorials
How to Change Sudo or Root Password in Ubuntu
Changing passwords is a good practice and should be done periodically.
Linux allows multiple user accounts, each having its own password. Users can only change their own password. However, there is always a sudo/root (SuperUser) account. Root users can change the password of any account, including their own. By default, the root user is locked.
There are three (3) ways to change passwords in Ubuntu.
The first two (2) options use the command line, and the other uses Linux’s graphical interface (GUI).
- Ubuntu installed and running
- A user with sudo privileges
- Access to a terminal/command line
- The apt-get tool, pre-loaded in Ubuntu and other Debian-based distros
Change the Root Password in Ubuntu
Option 1: Changing Ubuntu Password in the Command Line
To change the sudo password using the sudo command:
1. First, open the terminal using the keyboard shortcut CTRL+ALT+T.
2. Query for a password change by running the command:
You will be prompted to enter and verify a new password. The output will inform you the password was updated successfully.
Option 2: Change sudo Password with the passwd Command
An alternative is to switch to the root user and then run the passwd command to change the root password.
1. First, open the terminal (CTRL+ALT+T).
2. Switch to the root user with the command:
Type in your current password and hit Enter. The output you receive should show that you can now run commands as root.
3. Next, change the password by running the command:
Type and retype a new password to verify the change.
4. After changing the password, log out of the root user with the command:
5. Exit out of the terminal with the same command:
Option 3: Changing Ubuntu Password Using GUI
To change the default root password in Ubuntu without using the terminal or any commands, use the graphical interface.
1. Open the Activities overview by pressing the Windows or Super key.
2. Type settings in the search bar and click on the Settings icon.
3. In Settings, click on the Details card (which is most likely the last one).
4. Next, click on Users. This lists all the details about the root user, including the password. Click on the password bar.
5. This will open a new Change Password pop-up. Type in your current root password, your new root password and verify the new password by retyping it.
6. Once you have filled in all the fields, click Change to confirm the changes.
This article provides three (3) ways to change the password for the root user on Ubuntu. Any of the three options include simple steps that anyone can follow and complete.
Finally, make sure that your password includes both lower and upper case letters, numbers and special characters. It is essential to have a strong password to prevent brute force attacks.