Skip to content
  • Home
  • About nixDrafts
  • Contact Us
  • Privacy Policy
  • Disclaimer
  • Terms and Conditions
  • UNIX
    • Solaris
    • AIX
    • RHEL
  • Virtual Machines
    • VMware Virtual Machines
    • Solaris Virtual Machine
    • ESX
    • Azure Virtual Machine
  • TOOLS
    • Storage
    • ASR
    • NetBackup
    • VCS
    • Bigdata
    • VxVM
    • Networking
    • Education
    • Tech News
  • Web Technologies
    • Web Hosting
    • Web Designing
  • Download Our Android App
  • Write for us
  • Sponsored Post
  • Blog
  • Facebook
  • Linkedin
  • Instagram
  • Pinterest
  • Twitter
  • Influencer
  • YouTube
Best Linux Blog for System Admins

nixDrafts – Best Linux Blog for System Admins

UNIX | LINUX | VERITAS | VMWARE | AZURE HOW TO TIPS & TRICS

Advertise here-720x90
  • Home
  • About nixDrafts
  • Contact Us
  • Privacy Policy
  • Disclaimer
  • Terms and Conditions

Latest Articles

How to Install SAMBA on LINUX

How to Install & Configure SAMBA on Linux

How to increase shared memory in RHEL7

Best Linux Apps for Every Kind of User

What is Linux ?

How to use help command in linux

Netbackup Tutorials : Troubleshooting Tips to resolve backup failures

Veritas Netbackup 8.1 Client Installation

All about Unix Linux System Administrator Roles and Responsibilities

Best Black Friday 2020 deals

How to reset hba port in linux

12 Restorecon linux commands examples

how-to-remove-dot-permission-in-linux

How to remove dot permission in linux

SELinux chcon command in Redhat Linux With Examples to Change Security Context

SELinux chcon command in Redhat Linux With Examples to Change Security Context

Linux Networking Commands

15 Useful Linux Networking Commands

Important_Linux-Commands_840x268

All Basic/Advanced Linux Commands for Linux Administrators Interview Questions PDF

how-to-disable-ip-forwarding-in-linux

How to disable IP forwarding in linux

memory-and-cpu-reservation-in-vmware

Memory and cpu reservation in vmware

Activating-and-Deactivating-volume-groups_840x268

How to activate volume group in linux

Sunday, February 28, 2021
linux-change-password

Linux Change Password

Contents

  • 1 Linux Change Password
        • 1.0.0.1 1. Password File
        • 1.0.0.2 2. Shadow File
        • 1.0.0.3 3.Group File
        • 1.0.0.4 4.nsswitch File
Share on Social Media
twitter facebook pinterest linkedin tumblr email
Follow us on Social Media
twitter facebook instagram pinterest linkedin tumblr

RSY Digital World Logo

Linux Change Password

Are you a Linux user by any means either student or professional or learning UNIX or LINUX or Linux system admin in your early stage of career?  Then this is the most basic but equally most important thing to know how you can do change passwords on Linux or UNIX. Linux Change Password is always required because due to increasing security threats most of the organizations have policies for password validity as a security standard.

There are many password complexity metrics that are being used to safeguard servers by organizations like password length, password expiry, and many others. Most of the organizations like financial organization, banks, and insurance firms, and even IT support organizations they have provision password to expire after every 90 days.

All the UNIX or LINUX Distributions have the same set of security standards. Few of the major UNIX or LINUX Distributions like Red Hat Enterprise Linux popularly referred to as RHEL, HP-UX, AIX, or Solaris. Linux change Password is going to be the same in any environment.

Types of Linux Users

Let us see what the provisions are under LINUX systems for user management. There is mainly three types of user that exist in all the environment.

  1. System Users/System ID
  2. Human Users/Users ID
  3. Application Users/Service ID

As the name suggests system users are the users who come by default with server build needs to run the operating system smoothly like root, NFS, or related to any system services.

Human users are authorized human users on the server for the specified purposes. For Example, any server gets build for a specific purpose and 100 users in that department all need to have access to the server for their due diligence of performing the assigned tasks. To keep server and data safe all organizations follow a set of rules to maintain passwords including password complexity and password expiration policy.

Application users also named Service Accounts. All Servers have service accounts that are not related to anyone human but broadly used by the application team and mostly they do not follow the password expiry standards because of the nature of the account. For example, if any batch has to be run until the server is live or you can say service business needs so password expiration will be a regular hurdle.

Unix/Linux: Local User Administration 

There are basically 4 main files in Linux Related to User Management. Those files are as below. All files exist in /etc folder.

1. Password File

passwd file is present in /etc directory. The syntax of the Password file looks like below.

 rajesh:x:1024:100:Rajesh Kumar – HR:/home/rajesh:/bin/bash

Let us briefly understand this. It contains 7 fields.

First Field: It is called Username: rajesh .this is id needs to be used for login purpose. We will see Linux change password for this ID later which is our ultimate goal of this post.

Second Field: X represents that this user has a password. This is also a security standard that there will be no user without a password in the server which opens the door for attackers.

3rd Field: 3rd field is called User is UID:1024 known as a User ID. All users in the system must have a UNIQUE ID.

Fourth Field: This is called GID:10 which is called Group ID. Many users can have the same group name for example if any group is created for any specific department users. So all users have unique IDs but the same group.

Fifth Field: We know this field as GECOS which means User Details in a simple way.

Sixth Field: This is called home folder for user>This folder is owned by the user itself. Users can read, write, and save content in this folder without any special permission.

7th Field: /bin/bash This field is known as the shell. There is the various shell you might be aware like bash which is the default shell in Linux while the sh shell is the default shell in UNIX.

2. Shadow File

The shadow file is also present in /etc directory and always in encrypted mode with no write permission for a normal user. This is the main file where our password gets stored. When you Linux Change Password this file only gets updated.

The syntax of this file is as below

rajesh: :$1$q5AAvJBe$hTu/UCpST7X3b.NBp3Us8:15779:0:90:10:::

UID:Encripted Password:90 Days Validity:10 Days before alert about password expiry.

Note: passwd file contains can be seen by the normal user but the normal user can not see the shadow file contents as mentioned earlier it is accessible with privilege id only.

3.Group File

Group file maintains a group name associated with group id.No two group names should have the same GID. Users can be part of any group.

The syntax of the group file is like below.

Group Name:x: GROUP ID: GROUP Members separated by a comma.

4.nsswitch File

This file is really important which defines how users are getting authenticated to servers. The sample file looks like below.

[[email protected] rajesh]# cat /etc/nsswitch.conf

# /etc/nsswitch.conf

# # The entry ‘[NOTFOUND=return]’ means that the search for an # entry should stop if the search in the previous entry turned # up nothing. Note that if the search failed due to some other reason # (like no NIS server responding) then the search continues with the # next entry.

passwd:  files

shadow: files

group:  files

This is a truncated output of the file. You can see here files are referred in front of passwd, shadow, group which means for all three it refers local system file for authentication purpose.

So now we have a fair idea about files which is responsible for managing users in the UNIX Linux system. So we will return to our main objective of the post- Linux Change Password.

How to Change Linux Password

So now we have to see how to Linux Change Password. Remember user can change it,s own password but if you want to change the other’s password you need privilege access on servers which is normally given to system administrators based on RBAC (Role-Based Access Control) is addressed by sudoers file which is also normally available in /etc folder.

Linux Change Password for own account

After logging to the system you can simply type passwd command which will allow you to change your password. If the user is resetting or changing his password himself user needs to enter his current password and then a new password he wants to set and reconfirm before the password gets successfully updated. In all cases, linux change password command will be passwd only.

-bash-4.2$ passwd
Changing password for user rajesh.
Changing password for rajesh.
(current) UNIX password:
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
-bash-4.2$
Linux Change Password for User

If a password is getting changed or reset for any user by someone who has privilege access on the server say system administrator’s current password is not required. It can be directly reset for the user because the user have right to reset/set a password for any user in the system or create a user in the system. This is all about the linux change password of user.

[[email protected] lnxprod01]# passwd rajesh

Changing password for user rajesh.

New password: Retype new password:

passwd: all authentication tokens updated successfully.

Linux Change Root Password 

We are going to see that how you can linux change root password so it is obvious that the user who is going to do linux change root password he must be having role assigned to do because the root is the superuser of all the UNIX and linux distributions.

Normally these privileges is granted to the system administrator or even few others may have been granted to do so.

passwd command can change root password also only difference is that the user is trying to reset or change the root password need to have the authority or you can say privilege to do so.

[[email protected] lnxprod01]# passwd root

Changing password for user root.

New password:

Retype new password:

passwd: all authentication tokens updated successfully. UNIX/LINUX Local User Administration is a different topic which needs separate discussion to discuss various commands like useradd, userdel, usermod, and chage commands can be discussed in detail.

That,s it about Linux Change Password. I hope we have discussed all that is intended in beginning and hope you like it. Please do let us know in case of any query you have about this post.

Request you to share as much as possible if you like the contents.

Below are a few other Linux related posts you can go through for making more familiar with Linux.

  1. How to Install uuencode In Linux
  2. How to Run FSCK Forcibly On Next Reboot in Linux
  3. How to Disable SELINUX in Linux
  4. How to fix Service Group Auto Disabled in VCS
  5. How to Fix Failover Service Group in VCS
  6. How to Identify HBA Cards Ports and WWN in Linux
  7. How to restart vxconfigd manually in VCS
  8. How to fix Resources not probed issues in VCS after upgrade
  9. How to Remove Veritas File Systems

 

Share on Social Media
twitter facebook pinterest linkedin tumblr email
Follow us on Social Media
twitter facebook instagram pinterest linkedin tumblr
change password in linuxchange password linuxChanging password for user roothow to change linux passwordhow to change password in linuxhow to change password linuxhow to change root password in linuxLinux Change Passwordlinux change password commandlinux change password for own accountlinux change password for userlinux change root passwordpasswd commandpasswordsTypes of Linux Users

Post navigation

How to Remove LDOM
how to remove files and directory on linux and unix

Categories

Recent Posts

  • How to restore Azure Virtual Machines from snapshots
  • How to Enable root SSH login on the ESXi host
  • How to Create Linux Virtual Machine in Microsoft Azure with CLI
  • How to Install & Configure SAMBA on Linux
  • Diskgroup fails to import with message license has expired or is not available for operation

Sign for Latest Updates

Storage

Restore Azure VM from snapshot
Azure Cloud

How to restore Azure Virtual Machines from snapshots

RSY Digital World February 4, 2021
How to Enable root SSH login on the ESXi host
ESX VMWare

How to Enable root SSH login on the ESXi host

Raj Rai February 4, 2021
How to Create Linux Virtual Machine in Microsoft Azure with CLI
Azure

How to Create Linux Virtual Machine in Microsoft Azure with CLI

Raj Rai February 2, 2021

Net Backup

Restore Azure VM from snapshot
Azure Cloud

How to restore Azure Virtual Machines from snapshots

RSY Digital World February 4, 2021
How to Enable root SSH login on the ESXi host
ESX VMWare

How to Enable root SSH login on the ESXi host

Raj Rai February 4, 2021
How to Create Linux Virtual Machine in Microsoft Azure with CLI
Azure

How to Create Linux Virtual Machine in Microsoft Azure with CLI

Raj Rai February 2, 2021
  • Products
  • Career Opportunities
  • Job Dashboard
  • Write for us
  • Submit Job
  • Post a Job
  • Linux Video Courses
  • Linux eBooks
  • Linux Print Books
  • Azure Exam Books
  • AWS Video Courses
  • FAQ
Copyright 2018-21 | All Rights Reserved | World`s Best Linux Blog
Privacy Policy