Scripting issues with adding users

Hello everyone, I am new to the forum community and need help with some scripts. First off let me put that this is “NOT” a homework assignment as I have been given this information where I work (IUPUI-UITS) and need help on this since I have no experience in this area. The only reason I am turning to forum posting is the person that ran the system is no longer available and now it is on me to run this so I am trying to find out whatever information I can. I just want to see what people may suggest about the code posted and good sites that may relate to what I am asking.

I have attached what I have been given so far and these are scripts that have been passed on to me. To tell the truth I have never really worked with scripts and have no clue how these even work (so any information or help that is dumbed down would be beneficial). The person that passed this on to me is no longer is available to be reached and they did not provide any documentation on this information.

I know the scripts are supposed to create new users to be used with mysql and phpmyadmin on a server. My questions are how do these even work and what do they do? Also if anyone has suggestions on how to make these more effective and secure feel free to try and help out or point me in the right direction. Another thing that I was wondering with these is how would I go about making changes to allow tracking of the accounts created and to create a script to remove all files associated with a specific user and have it stored in an archive. Thanks everyone and I appreciate you help.
 

Attachments

  • Scripts.zip
    4.1 KB · Views: 172
RisingT said:
I have attached what I have been given so far and these are scripts that have been passed on to me. To tell the truth I have never really worked with scripts and have no clue how these even work (so any information or help that is dumbed down would be beneficial).
Pardon my asking but what exactly do they expect you to do with these scripts?

Your question is a bit confusing to me since it basically boils down to "what do these scripts do", but that's something you should easily be able to answer yourself. After all: a script is basically one huge list of commands. And those commands can also be used on the console to see what they do (don't do such experiments while logged on as root though).

And since we're talking about both Perl and Bash scripts; why not start looking into those environments too?

Perl is well documented and a good place to get a global understanding of bash would be its manualpage ( man bash).

Still, I think it could be much more helpful if you could share what it is you're actually trying to do here.

RisingT said:
I know the scripts are supposed to create new users to be used with mysql and phpmyadmin on a server.
One thing immediately struck me when looking at new.sh:

Code:
#!/bin/bash
# Script to add a user to Linux system
if [ $(id -u) -eq 0 ]; then
	read -p "Enter username : " username
	read -s -p "Enter password : " password
That code would never work on a FreeBSD system unless it got horribly mutilated; on FreeBSD a shell like bash would normally never end up in /bin. And that's ignoring the non-existent useradd on FreeBSD.

And the comment line kind of confirms all this: this is a Linux related issue. And Linux really doesn't have that much in common with FreeBSD, especially when we're talking about specific topics such as user management and such.

RisingT said:
Another thing that I was wondering with these is how would I go about making changes to allow tracking of the accounts created and to create a script to remove all files associated with a specific user and have it stored in an archive.
Make it create and maintain a logfile? You could, for example, tell it to add an entry to a logfile which contains a timestamp and a short description of what it did.
 
Back
Top