Comments on How To Add Users To Linux OS From A Text file

How To Add Users To Linux OS From A Text file This tutorial is about a bash script to add, delete and verify the users either from a text file; it can also add, delete and modify the users manually. This script can be used to add , delete and verify the users to the Linux OS by fetching the user's information from any text file and this script can also add, delete or verify the users manually, I have put both of these functions in one script file. The text file can be specified by the administrator.

6 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Anonymous

HI,

The script is good, but it it not generic enough. I think it is a good idea to use awk to extract data instead of grep and use usernamexxx pattern.

Great Job though.

Thanks,

 

By: menelik

Great Job!!. That is what I always wanted. Cheers !!

By: Alan

I find it hard to believe this piece of code remains unchallenged for so long. While its function is fairly clearly explained, the code itself is inconsistent, clunky (I would not want boxes of '#' symbols cluttering my screen) and will not work. For example, in one section he cuts the same data into three different shell variables. This would be of more value as a debugging exercise for a rookie programmer.

By: Anonymous


I got this error,when i m executing the script in centos 6.5(tried with bin/sh and bin/bash)
 
'seradv.sh: line 2: syntax error near unexpected token `
'seradv.sh: line 2: `add_users()
 
Please help me out.Thanks 

By: nariman

Thank you for this awesome script and explanation, it is fantastic !

By: Raju Balami

I tried to delete users stored in my users.txt file, but it shows some error.

ERROR---

Do you want to use the above Default PATH? Yes=1 & No=2

1

./automata: line 166: [: ==: unary operator expected

usage: userdel [-r] name

./automata: line 162: [: !=: unary operator expected