Hi, guys,
With some guys' help, I made a shellscript used to create new users(attached at the bottom).
I have some questions: a). I need to prompt users to enter their password in my script, but when users type in their password, it's visible on screen. Is there any ways to hide the STDIN or make it invisible on screen? b). I want the password contains at least one lowercase and one uppercase and one digit and one punctuation and the length must be between 8 and 16 characters long.
I validated it by using below code:
however, if the password is set to "3o1416!@#" and it doesn't apparently contain a uppercase, it can still pass the validation.
I don't know why and please give me a direction. c). very important in my script adding a new user is designed as an interactive process, and I know it can be also designed as non-interactive.
Which is more commonly used?
What do you think of my script?
Thank you.
a). I need to prompt users to enter their password in my script, but when users type in their password, it's visible on screen. Is there any ways to hide the STDIN or make it invisible on screen? b). I want the password contains at least one lowercase and one uppercase and one digit and one punctuation and the length must be between 8 and 16 characters long.
Don't do it this way. You are trying to re-invent the wheel here. Instead of letting user enter a password you should set a random password (use /dev/random to do so), send it per mail to the user (or some similar way) and let the user change it when they first log on. You can set the characteristics for valid passwords, depending on the flavour of your OS, and let system utilities (like passwd) do all this validation work and the hiding what has been typed, etc.. No need to program this in shell for a second time.
Don't do it this way. You are trying to re-invent the wheel here. Instead of letting user enter a password you should set a random password (use /dev/random to do so), send it per mail to the user (or some similar way) and let the user change it when they first log on. You can set the characteristics for valid passwords, depending on the flavour of your OS, and let system utilities (like passwd) do all this validation work and the hiding what has been typed, etc.. No need to program this in shell for a second time.
I hope this helps.
bakunin
I think you are right.
What about my third question?~~
The automated nature of the random password method means the admin never has a user's password. The password should be force-expired by the same automated process, so it must change during the first login. While on UNIX root can log in as any user, and probably cover any tracks, on other systems like RDBMS that is not true. If anything goes seriously sideways, the admin does not want to have any knowledge of user passwords.
Sprint does this really badly, showing associates your password and making you say it over the phone. It makes me sick every time they do!
1.) I am to write scripts that will be phasetest folder in the home directory.
2.) The folder should have a set-up,phase and display files
I have written a small script which i used to check for the existing users and their password.
What I need help with:
I have a set of questions in a... (19 Replies)
Hello.
I am a beginner and I need to create a script that goes:
There are several library where there are compressed files. I have to decompress all files that start with 'XA%' and retrieve all rows that contain 'CSSF' and copy this to a file.
Can anyone help me? Thank you in advance :) (5 Replies)
guys,
I need a steer in the right direction for this issue. it would be great if anyone of you can help me out.
i have a textfile where i want to swap the lines based on the user input.
The textfile is looks like the
#file 1 name
TB
#file 1 ID
1000
#
#file for ID1 system1... (3 Replies)
hi
i want to write a script that contain questions upto 50..when i run the script it has to ask the questions one by one with options like a,b,c,d and user has to answer the each question and finally result (contain how many user selected correctly)
please help me...i need hints to do....... (8 Replies)
I'm trying to set up a php script that runs via crontab on a server. I've never done anything like this before.
My questions:
1) I want the crontab to run the script everyday from 3:58 PM to 4:13 PM EST. How is that written in crontab?
2) The command I want crontab to run is: php -q... (3 Replies)
Q1>How do i read and write to file in shell script. Here is what i want let's assume the filename as "file1"
Read file1
Check the content of file1 which can be either "0" or "1"
if(content == 0)
{
execute a command
}
flush file1(remove all contents in it)
write "1" in to... (5 Replies)
Hi
Can u please guide me to understand following script :
$JAVA_HOME/bin/java -cp $CLASSPATH -Djava.naming.factory.initial=weblogic.jndi.T3InitialContextFactory -Djava.naming.provider
.url=$INITIAL_CONTEXT_PROVIDER -Djava.naming.security.principal=system... (2 Replies)
Hi all,
My tiny mind is struggling with the following script that shuts down Tomcat on Sol. 8 and kills any defunct processes Tomcat might leave behind (as it so often does). I realize that fixing Tomcat would be best, but this is a band-aid so I won't have to do as much off-hours support of... (3 Replies)
Hi all,
Just two quick questions about writting some scripts.
The script I am writting has to be able to add users. Well I can work out the commands I need to put in for the user to be added. But how would I need to do to set the password for that user. Keeping in mind the script will be run... (1 Reply)