{"id":5126,"date":"2021-03-18T09:57:39","date_gmt":"2021-03-18T09:57:39","guid":{"rendered":"https:\/\/linuxways.net\/?p=5126"},"modified":"2021-03-18T09:57:39","modified_gmt":"2021-03-18T09:57:39","slug":"how-to-change-user-password-in-linux-2","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/how-to-change-user-password-in-linux-2\/","title":{"rendered":"How to Change User Password in Linux"},"content":{"rendered":"<p>Your systems carry a lot of confidential and important data. One of the most effective ways to protect and safeguard your system from unauthorized access is to use a strong password. Generally, when you install Ubuntu, you <a href=\"https:\/\/linuxways.net\/de\/ubuntu\/how-to-add-and-remove-users-on-ubuntu-20-04\/\">create users<\/a> and assign passwords and you don\u2019t feel the need to change them. However, there are some scenarios where you need to change it like if you have a weak password and you want to set a new strong password. Similarly, as a system administrator, you might need to modify the passwords of users. Whatever the reason it might be, you can easily change the user password in Linux either through the command line or through the GUI.<\/p>\n<p>This guide will explain how to change the password for your and other user accounts through both the command line and GUI. It will also cover changing the password for the root account and forcing a user to change their password at the next login.<\/p>\n<p><strong>Note<\/strong>: We have tested the commands described here on Ubuntu 20.04 LTS. However, the same commands also work for other Linux distributions.<\/p>\n<h2>Change User Password through Command Line<\/h2>\n<p>In Linux, you can do almost everything with the command line using only a single command. The same goes true with changing the user&#8217;s passwords. In this method, we will show how to modify the password of a user from the command line.<\/p>\n<h3>Change Your Own Password<\/h3>\n<p>To change your own password, simply type the below command without sudo in your terminal window:<\/p>\n<pre>$ passwd<\/pre>\n<p>Now follow the prompt; enter your current and new password.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"566\" height=\"162\" class=\"wp-image-5127\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-218.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-218.png 566w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-218-300x86.png 300w\" sizes=\"auto, (max-width: 566px) 100vw, 566px\" \/><\/p>\n<p>After doing so, your password will be changed.<\/p>\n<h3>Change Password for Another User<\/h3>\n<p>To change the password for another user, you will need sudo privileges or will have to switch to the root account. Use the command below for changing the password for any other user:<\/p>\n<pre>$ sudo passwd &lt;username&gt;<\/pre>\n<p>For instance, to change the password for a user named \u201csim\u201d, the command would be:<\/p>\n<pre>$ sudo password sim<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"137\" class=\"wp-image-5128\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-219.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-219.png 512w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-219-300x80.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/p>\n<p>After doing so, the password of the user will be changed.<\/p>\n<h3>Change Root Password<\/h3>\n<p>When you install the Ubuntu system, there is no root password set; you have to manually set it. A sudo user can change the password of a root account. To set the root password or if you have already set it but want to change it, then use any of the below commands:<\/p>\n<pre>$ sudo passwd<\/pre>\n<p>Or<\/p>\n<pre>$ sudo passwd root<\/pre>\n<p>First, provide the password for sudo, and then enter the new password that you want to set for the root account.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"409\" height=\"115\" class=\"wp-image-5129\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-220.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-220.png 409w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-220-300x84.png 300w\" sizes=\"auto, (max-width: 409px) 100vw, 409px\" \/><\/p>\n<p>After doing so, the password of the root account will be changed.<\/p>\n<h3>Force a User To Change Its Passwords<\/h3>\n<p>If a system administrator has created user accounts and set passwords itself, then he can force the users to change their passwords at the next login. It can be done through the <em>passwd<\/em> command with <em>&#8211;expire<\/em> option as follows:<\/p>\n<pre>$ passwd --expire &lt;username&gt;<\/pre>\n<p>For example, to force a user named \u201csim\u201d to change its password on the next login, the command would be:<\/p>\n<pre>$ passwd --expire sim<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"492\" height=\"68\" class=\"wp-image-5130\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-221.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-221.png 492w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-221-300x41.png 300w\" sizes=\"auto, (max-width: 492px) 100vw, 492px\" \/><\/p>\n<p>This command will force expire the password for the user \u201csim\u201d and will ask it to set the password itself on its next login.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"491\" height=\"339\" class=\"wp-image-5131\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-222.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-222.png 491w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-222-300x207.png 300w\" sizes=\"auto, (max-width: 491px) 100vw, 491px\" \/><\/p>\n<h2>Change Password through GUI<\/h2>\n<p>If you prefer working in a graphical environment rather than working on the command line, you can use the below-described method for changing the password for a user account.<\/p>\n<p>Step 1: Open Settings application in your system. You can do so right-clicking the desktop and choosing <strong>Settings<\/strong> from the appeared menu. Alternatively, you can press the super key and in the search area, type <em>settings<\/em>. Then from the search results, select the Settings utility.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"278\" height=\"422\" class=\"wp-image-5132\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-223.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-223.png 278w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-223-198x300.png 198w\" sizes=\"auto, (max-width: 278px) 100vw, 278px\" \/><\/p>\n<p>From the left window, switch to the<strong> Users<\/strong> tab. Then in the right window, click <strong>Unlock<\/strong> button. <img loading=\"lazy\" decoding=\"async\" width=\"818\" height=\"438\" class=\"wp-image-5133\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-224.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-224.png 818w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-224-300x161.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-224-768x411.png 768w\" sizes=\"auto, (max-width: 818px) 100vw, 818px\" \/><\/p>\n<p>Now you will be asked to authenticate by providing the password and then clicking the <strong>Authenticate <\/strong>button. After doing so, user settings will be unlocked.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"385\" height=\"340\" class=\"wp-image-5134\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-225.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-225.png 385w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-225-300x265.png 300w\" sizes=\"auto, (max-width: 385px) 100vw, 385px\" \/><\/p>\n<p>Now choose the user account whose password you want to change. It can either be your account or another user\u2019s account.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"849\" height=\"600\" class=\"wp-image-5135\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-226.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-226.png 849w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-226-300x212.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-226-768x543.png 768w\" sizes=\"auto, (max-width: 849px) 100vw, 849px\" \/><\/p>\n<p>In the following dialog box, type your current password. After that in the next fields, type new password. Then click <strong>Change<\/strong> to apply it.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"494\" height=\"260\" class=\"wp-image-5136\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-227.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-227.png 494w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-227-300x158.png 300w\" sizes=\"auto, (max-width: 494px) 100vw, 494px\" \/><\/p>\n<p>After you complete the steps, the password of the user will be changed.<\/p>\n<p>This is how you can change user password in Linux either graphically or using the command line. This post covered how to change password for current user account, for any other user and the root account. Hope it helps!<\/p>","protected":false},"excerpt":{"rendered":"<p>Your systems carry a lot of confidential and important data. One of the most effective ways to protect and safeguard your system from unauthorized access is to use&hellip;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,2],"tags":[215,100,155],"class_list":["post-5126","post","type-post","status-publish","format-standard","hentry","category-centos","category-ubuntu","tag-password","tag-ubuntu-20-04","tag-user"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/5126","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=5126"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/5126\/revisions"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=5126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=5126"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=5126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}