add user accounts

Posted on 2005-03-08
Medium Priority
Last Modified: 2013-12-16
Hello experts,

Recently I reinstaleed whole server frm debian 3.0 woody to Ubuntu Linux. I kept all conf files from the previous system including /etc/passwd and /etc/shadow /etc/samba/smbpasswd. Before I start creating all account on new system manula I would like to aske if there is some way how to automatize this process. All users home folders are already mounted as different partion. I'm thinking about create script which will read my old passwd file and add new users to new system. It is something around 70 names. Is there a chance to automatize this somehow?


Question by:Luxana
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 13492788
did u try using the old files? I would.

Assisted Solution

esanchezvela earned 400 total points
ID: 13492826

ok, I think you would like to make a test first.

make a copy of a line from /etc/passwd and  /etc/shadow into the respective new files, and try to login as the user. chances are that it will work, the same for the Samba password file.
LVL 38

Accepted Solution

yuzh earned 800 total points
ID: 13492878
In most case, the old files should work, you need to remember to modify the home dir in /etc/passwd file if they are differ from the old one, don't forget the /etc/group file.

It is possible to use script to create all the new users for you, you can create a text file
with loginname passwd home_dir shell etc, and use the script to read the input file and create
the users.

Have a look at http:Q_21112403.html  to get some idea how to write the script.
LVL 40

Assisted Solution

jlevie earned 400 total points
ID: 13493265
Since you still have the home directories the easy way to add the users is to merge the lines for those users from the old files (passwd, shadow, group, & gshadow) into the coresponding files on the new system. Since you've changed versions I would not simply copy the old files into place since system accounts may be different.

Assisted Solution

mike_mian earned 400 total points
ID: 13521092
here's a little script that may help

assuming that  pevious files are in the same dir and you added the extension .old_deb to them

for f in passwd groups shadow
# copy the sytem installed files in case thing go bad
cp $f $f.orig
cat $f.old_deb >> $f
cat $f  | sort  | uniq > tmp
mv tmp $f

you can then scan the file with vi and remove any dodgy dups where for example the shell path is wrong.

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month12 days, 4 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question