Linux change sudo password

How to change the sudo password through command line on CentOS 8

Change sudo password

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:

CentOS Terminal

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.

Beome root user by using sudo command

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:

Change sudo password

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.

Читайте также:  Создать ftp пользователя linux

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:

Exit from root session

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.

One-liner to change sudo password

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 изменить пароль суперпользователя, если вы знаете текущий пароль, и если вы его не знаете .

Если вы знаете пароль

Изображение с названием Change the Root Password in Linux Step 1

  • Если вы не пользуетесь средой рабочего стола, вы уже находитесь в терминале, поэтому перейдите к следующему шагу.

Изображение с названием Change the Root Password in Linux Step 2

Введите su в терминале и нажмите ↵ Enter . [2] X Источник информации На следующей строке появится слово Password: (Пароль).

Изображение с названием Change the Root Password in Linux Step 3

  • Если вы ввели неверный пароль, введите su и повторите попытку.
  • Пароли чувствительны к регистру.

Изображение с названием Change the Root Password in Linux Step 4

Введите passwd и нажмите ↵ Enter . На новой строке появится Enter new UNIX password: (Введите новый пароль).

Изображение с названием Change the Root Password in Linux Step 5

Изображение с названием Change the Root Password in Linux Step 6

Введите новый пароль еще раз и нажмите ↵ Enter . Вы увидите сообщение «Password updated successfully» (Пароль успешно обновлен).

Изображение с названием Change the Root Password in Linux Step 7

Если вы не знаете пароля

Изображение с названием Change the Root Password in Linux Step 8

Изображение с названием Change the Root Password in Linux Step 9

  • Если вы не успели нажать E , и меню Grub исчезло с экрана, перезагрузите компьютер и попробуйте снова.
  • Этот метод работает в большинстве популярных дистрибутивов Linux (Ubuntu, CentOS 7, Debian). Существует много дистрибутивов Linux, и если у вас не получается перейти в однопользовательский режим с помощью этого метода, почитайте инструкции к своему дистрибутиву (на сайте его разработчиков).

Изображение с названием Change the Root Password in Linux Step 10

Изображение с названием Change the Root Password in Linux Step 11

Переместите курсор в конец строки. Используйте клавиши → , ← , ↑ и ↓ , чтобы поместить курсор сразу после ro .

Изображение с названием Change the Root Password in Linux Step 12

Изображение с названием Change the Root Password in Linux Step 13

Нажмите Ctrl + X . Это сообщит системе о том, что в однопользовательском режиме нужно сразу открыть терминал с правами суперпользователя.

Изображение с названием Change the Root Password in Linux Step 14

Введите mount –o remount,rw / в терминале и нажмите ↵ Enter . Это приведет к монтированию файловой системы в режиме чтение/запись.

Изображение с названием Change the Root Password in Linux Step 15

Введите passwd в терминале и нажмите ↵ Enter . Так как в однопользовательском режиме вы автоматически получаете права суперпользователя, нет необходимости добавлять в эту команду дополнительные параметры.

Изображение с названием Change the Root Password in Linux Step 16

Введите новый пароль суперпользователя и нажмите ↵ Enter . Вводимый пароль не будет отображаться на экране.

Читайте также:  Fopen failed no such file or directory kali linux

Изображение с названием Change the Root Password in Linux Step 17

Введите новый пароль еще раз и нажмите ↵ Enter . Когда система подтвердит, что оба пароля совпадают, вы увидите сообщение «Password updated successfully» (Пароль успешно обновлен).

Изображение с названием Change the Root Password in Linux Step 18

  • Пароль должен включать не менее 8 символов и содержать сочетание букв (прописных и строчных), цифр и символов.
  • Чтобы изменить пароль для другого пользователя, введите su , чтобы получить права суперпользователя, а затем введите passwd .

Дополнительные статьи

взломать WPA/WPA2 ключ от Wi–Fi с помощью Kali Linux

стать суперпользователем в Linux

заархивировать папку в Linux

проверить IP адрес в Linux

добавить или сменить шлюз по умолчанию в Linux

использовать Wine в Linux

установить Ubuntu в VirtualBox

назначить IP адрес в Linux

создать и отредактировать текстовый файл с помощью терминала в Linux

отформатировать жесткий диск в Ubuntu

восстановить Ubuntu

отформатировать флешку в Ubuntu

Об этой статье

В создании этой статьи участвовала наша опытная команда редакторов и исследователей, которые проверили ее на точность и полноту.

Команда контент-менеджеров wikiHow тщательно следит за работой редакторов, чтобы гарантировать соответствие каждой статьи нашим высоким стандартам качества. Количество просмотров этой статьи: 25 685.

Источник

How to Change sudo Password in Ubuntu 22.04

Change sudo password in Ubuntu

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.

Become root user on Ubuntu

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:

Change root password on Ubuntu

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.

Читайте также:  Installing kali linux 2016

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.

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).

header image how to change ubuntu default root password

  • 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.

example output after ubuntu changing root password

image of terminal to exit changes after password reset

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.

example command for sudo -l

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).

example of Ubuntu graphical interface with details selected

4. Next, click on Users. This lists all the details about the root user, including the password. Click on the password bar.

GUI example of Ubuntu users and password

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.

change password prompt in ubuntu

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.

Источник

Оцените статью
Adblock
detector