323

If I change the password for the root user is that going to automatically change the password for the user account?

I found this link for root:

WikiHow: How to Change the Root Password in Linux

How do I change the user account password?

Alisha
  • 3,341
  • 2
  • 14
  • 8
  • 4
    New users take note: with Ubuntu, "By default, ... you cannot login as root directly or use the su command to become the root user. However, ... it is still possible to run programs with root-level privileges. This is where sudo comes in ... Just remember, when sudo asks for a password, it needs YOUR USER password, and not the root account password. ... Enabling the root account is rarely necessary. Almost everything you need to do as administrator of an Ubuntu system can be done via sudo or gksudo." (Excerpts from RootSudo on Ubuntu wiki.) – Evgeni Sergeev Jan 05 '17 at 05:06

2 Answers2

509

To do it using command line:

To change the root password:

sudo passwd

To change your user password:

passwd

To change other users password:

sudo passwd USERNAME

To do it GUI open the application User Accounts from the Dash and there you can change password easily for all users unless the root

Maythux
  • 84,289
  • 9
    For other Ubuntu newbs like me, NB that the root password is not the same as "the admin" password. If you want to change an admin password for the current user, use the version without sudo. (This was not obvious to me, coming from a Windows background.) –  May 30 '16 at 23:21
  • 1
    @ibgib Actually a Linux 'admin' is basically any user that can run as root. In Windows 'Run as Administrator' is similar to 'sudo'. When you run sudo with any command you are running as root, and thus sudo passwd will reset password for user root. Running passwd will reset the password for the existing user. – Molten Ice Sep 19 '16 at 22:26
  • 1
    @ Molten Ice Thanks for your comment! It sounds like you're a Linux guru which is great! My comment is intended for Windows-oriented audiences. My point is that there is a difference between "root" password and "the admin" password. My experience, coming from a Windows background, had these two as equivalent, and so I used the version with sudo which was of course wrong. This threw me and I had to reread the answer (which is correct) to understand the situation. I posted the comment to help others who may have this same incorrect interpretation of the answer. –  Sep 21 '16 at 14:52
  • 4
    @ibgib What @Molten Ice was pointing out is that there is no such thing as an ‘admin’ password for a user. All users have a password. Some users may have admin privileges, which, when using the sudo command, is used to ‘prove’ that it is really that user at the keyboard. And root is a user that has all admin privileges by default and doesn't need to use sudo to exercise those privileges. (Use sudo -i to ‘become’ root.) – equaeghe Sep 29 '16 at 16:15
  • @equaeghe Thanks for your input also! Indeed, I think we're shadowboxing here. I understand that there is no "admin" password. That is why I put "the admin" in quotes in my comment. I should have enclosed it in quotes the second time as well. I also understand what sudo is doing in the context you describe! Again, my point is that coming from a Windows background, I had the thought "Hey I'm on my primary account on this Ubuntu box, the analog of which in Windows is an admin account in Windows for convenience, so I better use the sudo version", which of course is wrong...hence my comment –  Sep 29 '16 at 16:54
  • This code is not working well. I followed the same thing but my password does'n change – Pankaj Kumar Gautam Dec 26 '16 at 13:09
  • 1
    @ibgib: without the intention to come across a bit harsh about your windows background (I've had my share of win95 till winXP as well, moved to macosx and linux, both personal and professional) my advise is to forget everything you know about sysadmin (as long as it based on your experience with windows) and start all over in any *nix environment. (which is, at least that's my experience, great fun!) – RemyNL Jan 20 '17 at 11:21
14

As a user, you can change your own password in a terminal, using passwd. You will be asked for the current password and can then enter a new one.

On Ubuntu, there normally is no separate password for root. Instead, users with administrator privileges may use sudo to run commands as a super user.

  • ok yea just saw this post http://www.cyberciti.biz/faq/changing-password-of-specific-account-in-linux-commandline/ but still thanks for clarifying. – Alisha Feb 21 '14 at 00:55
  • Do I have to restrta my machine ?! because now I can log-out and log-in again using the old password !! .. – McLan Nov 03 '17 at 12:02