Pages

How to Delete User Account Passwords using Command-Line in GNU/Linux?

Although these days the GNU/Linux operating system is a very user-friendly one thanks to the easy to use GUI (graphical user interfaces) which are usually created using both GTK and Qt toolkits. But as everyone knows, the true power of GNU/Linux lies in the "shell" or the command-line "interface" where you have the ability to execute commands using nothing but your keyboard.

The reason for this "behavior" is actually quite simple. It's because in the early days GNU/Linux was created by + for advanced PC users such as "ethical hackers" (the good fellas :P), programmers and system administrative type individuals.

This has both good and bad aspects but as said before those days are pretty much "over", for the average user. Although the GNU/Linux shell (came from Unix) or the command-line is still heavily in use...

Anyhow, one of the advantageous of using a shell command instead of a GUI is that, depending on the need, the shell command can do the same many times quicker than the GUI counterpart (not always true though).

This is because, one of the main issues that programmers usually confronted while creating GUI programs is the levels of "distractions" they create because of their nature (you know, they are more attractive than ugly command-line ones :D).

So, if you wanted to delete/disable a user account's password in GNU/Linux (say Ubuntu in this example) then you can use the built in GUI tools but as mentioned above, by using the command for that exact purpose in the "Terminal" window, you can achieve the same task, much more quicker!.

What is the use of this command anyway?

Well, let's say that you have a shared Linux computer (by your family, more than a single account) and someone couldn't remember their password and asked you to complete delete it so he/she can add a new one later.

In that case, you can log-in to your admin account and use the "standard" GUI tool OR, do that by using a single command which is quite fast as mentioned before + most importantly, you should use "opportunities" like these to showoff and let them know that you're in charge :P.

Sounds good Gayan, Lets do that!...

For this example I'm using my own beautiful other name :P "sameera". Now remember, GNU/Linux is a case sensitive operating system + when it comes to a user account, there are two main types.

*. The "actual" user name.

*. The "display" name.


For instance, I can enter "SAMEERA" or "SaMeeRA" as the display name, but the OS will automatically convert it to "sameera" (lower case - only), which is the actual user-name, because in GNU/Linux, user accounts are only kept in lower-case letters.

So, make sure to use the "actual" user name with the following command, not the display name.

1. Open your Terminal and enter the below command. Replace the text "name" with your actual user account name.
    sudo passwd -d name

That's it dudes!. Pretty simple stuff right?.

Also, as long as you remember the "sudo" password, you can even delete the default "sudo" attached user account (default admin) in Ubuntu (which is the first user account that you create while installing the OS).

To do that just use the the above command and replace the "name" with that defalut user account which holds the administrative privileges. But remember, if you do that, it raises security concerns since the apps that needs root privilages can now run freely (not all of them, but most).

So don't do that. You can add a new password for that admin account by using the below command afterward.
passwd name

Again, replace the name with that default account you created while installing Ubuntu and it'll ask for a new password and follow the on screen details. Once logged in to their accounts, other users can also use that command to change/add a new password, to their accounts as well.

You can read more about this Unix command-line which is called "passwd" by entering the below command which should open the manual. Enjoy.
    man passwd

No comments:

Post a Comment