---
title: "Comment by priyadarshi ranjan on \"Day 5: Advanced Linux Shell Scripting for DevOps Engineers with User Management\" | Hashnode"
description: "useradd -m -p \"$(openssl passwd -1 $password)\" \"$username\" is used to create a new user account with specific options useradd: This command adds a new user to t"
url: "https://hashnode.com/posts/day-5-advanced-linux-shell-scripting-for-devops-engineers-with-user-management/66863d81a2bbc29831ef85a4/comment/6686edd08ad44b8c27e7a2a8"
---

[Discussion](https://hashnode.com/posts/day-5-advanced-linux-shell-scripting-for-devops-engineers-with-user-management/66863d81a2bbc29831ef85a4)

Comment [Day 5: Advanced Linux Shell Scripting for DevOps Engineers with User Management](https://hashnode.com/posts/day-5-advanced-linux-shell-scripting-for-devops-engineers-with-user-management/66863d81a2bbc29831ef85a4)

[priyadarshi ranjan](https://hashnode.com/@Darshi1108)

[Jul 4, 2024](https://hashnode.com/posts/day-5-advanced-linux-shell-scripting-for-devops-engineers-with-user-management/66863d81a2bbc29831ef85a4/comment/6686edd08ad44b8c27e7a2a8)

useradd -m -p "$(openssl passwd -1 $password)" "$username" is used to create a new user account with specific options

useradd: This command adds a new user to the system

\-m: Creates the user's home directory if it doesn't exist

\-p "$(openssl passwd -1 $password)": Sets the user's password securely. Here, openssl passwd -1 $password generates an encrypted password hash using OpenSSL's MD5 algorithm (-1 flag). This hash is then passed to -p for setting the user's password.

"$username": Specifies the username for the new user. Real-life Example: Imagine a scenario where a DevOps engineer automates user account creation across multiple servers. They use this command in scripts to ensure that each new user has a secure password and a home directory, ensuring consistency and security across the infrastructure.  
[Sibasundar Sahoo](https://hashnode.com/@Sibasundar01) you can check this
