Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8922221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:46:44+00:00 2026-06-15T06:46:44+00:00

I would like to create some new users on the system with a different

  • 0

I would like to create some new users on the system with a different naming schema:

  • old: firstname+initial of the second name (eg : johnk)
  • new: firstname.surname (eg : john.kennedy)

I am stuck with the password change for the new users. Ideally I would like to pull the shadow password from the file but I am still learning the BASH scripting and I think it’s too advanced , so for now i have just created a list with old users and the corresponding shadow passwords.
I was thinking to update the new user passwords with: /usr/sbin/usermod $u -p "$HASH" but I’m not sure how to list and match the old users to new users for this command.

#!/usr/bin/env bash

OLD="
johnk="shadow_hash"
...
"

NEWUSERS="
john.kennedy
...
"

for u in $NEWUSERS; do

  if [ -z "$(getent passwd $u)" ]; then

    echo "User $u does NOT exist, creating..."

    /usr/sbin/useradd $u
#    /usr/sbin/usermod $u -p "$HASH"
  else
    echo "User $un DOES exist."
  fi
done
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:46:45+00:00Added an answer on June 15, 2026 at 6:46 am

    Do you really want to create new users, or just add a login alias for an existing user? (Or, even simpler, change the user name?)

    If you create a new user, then you’ll need to fix a lot of file permissions, which could be annoying.

    You also have to deal with the name of the home directory, which is probably related to the old user name. You could just create a symlink from the new name to the old name (or rename the directory and symlink the old name to the new name; but make sure they’re not doing anything with their files while you do that).

    In any event, however you do it, you can use the numerical user id to relate the two names. For an alias, you would create the new name with the same numerical user id (you need to specify a flag to usermod to allow this to work) and you still need to deal with the name of the home directory and possibly other names, but you don’t need to fix permissions. If you don’t want to create aliases, you could create all the new user names with numerical user ids at a fixed offset from the old one (like 200 higher, for some value of 200). Note that getent allows lookup by either user name or numerical user id.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to create a caching system that will bypass some mechanisms in
I would like to create some kind of structure to reduce the number of
I would like to create some buttons with dynamic width using CSS sprites and
I would like to create some sort of function where you pass in a
I'm working from a JavaScript book and would like to create some menus using
I create some dynamic textbox's and a button in a placeholder and would like
I would like to create a file which stores some data that can be
I would like to create an outlook message with a subject and some attachments
I have authored some custom classes that I would like to create using XAML:
We have some Microfocus Cobol.Net applications. We would like to create a dependency map

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.