Hi I am new to unix and I am trying to figure out how to write a shell script with a login name and password. I want to do something along the lines of if both are correct it echoes "you are logged in" and if the password is wrong it echoes "wrong password" and same with the login name. I've tried to do it with if then statements but i can't seem to get it to work but I think i am going about it the wrong way. Please help!
Thanks
As Karthik said,I too don't know where you get the user name and password.But,I wrote the following script to read the user name and password from user and then comparing it.
The script is as follows.
Last edited by Scott; 02-25-2010 at 11:58 AM..
Reason: Please use code tags and indent your code
vivekraj, you seem to understand what i need to do. I attempted something similar but i was having trouble comparing the two (username and password). What if i wanted to do this for multiple users? Would i use a CASE statement? such as:
But then i'm thinking this would affect the whole code and you would need the names as such: alex | sean | ashley.
What do you guys think?
---------- Post updated at 11:35 AM ---------- Previous update was at 10:51 AM ----------
also guys, this is what i had so far. i know it's wrong (especially the * part, it doesn't work) but like i said i am very new to this. i was trying to do this for one user first but i actually want to do multiple like i mentioned.
---------- Post updated at 02:02 PM ---------- Previous update was at 11:35 AM ----------
ok i rewrote the code to this:
the only thing i am having trouble doing is adding multiple usernames to the if statement
Last edited by pludi; 02-25-2010 at 04:17 PM..
Reason: Please use code tags.......
i think it is pretty good! It has option to change your password, answer to the recall question in order to take it back and change the question to the recall question !
Hi,
I have a shell script (script.sh) in which we are calling java code which asks for
Username:
Password:
for authentication purpose
currently we are passing the credential manually and run the script.
but I am trying
echo -e "user_id\npassword" | script.sh
but its not... (1 Reply)
How to get the user name of the Operating system from an Informix 4gl program.
eg:-
-rw-r----- 1 gkuser srth1 292 Jul 27 19:28 u1.txt
i need to get gkuser as the result? (0 Replies)
Picked up a 3b2 running System V. Works fine, but it requires a username and password. Is the username "root" or "sysadm"? How do I find out and how to I reset it or bypass it?
Thanks. (2 Replies)
Hi
I am new to using unix and am struggling with a script i am writing. What i am trying to do is get a user to enter a username, check the original file i created with username and pin to see if their is a corresponding entry. Next ask the user to enter the pin and see if this matches... (5 Replies)
Can any body help me to find out the logic
I have a script chkcomponent.pl Which give some output
Like
component1 userid: u1
component2 userid: u2
component3 userid: u1
.
.
#The no of components are different in different times run
Now I want this chkcomponent.pl script... (1 Reply)
Hi All,
I want to login to a server through SFTP by giving username and password, in an automated script.
I know that this can be done through public key authentication, but my requirement is to login ONLY through username and password.
I am using GNU/Linux server.
Please advise me !!!... (4 Replies)
hi all,
i run sqlplus command on unix(HP-UX)
like "sqlplus username/password@serverA @deneme.sql"
but when someone run "ps -ef | grep sqlplus", it can see my username and password :(
How can i hide username and password.
thanx. (1 Reply)
Dear All
I am trying to write one shell which will be running through Cron which contain one SQL query. But I want to draw/fetch the Username password and Instance name (required to loging to the database) from one single file to run that SQL query . Also this file contain details of multiple... (2 Replies)
Can we write a script to telnet to a unix server from unix with the username and password hardcoded in the script??
something like ssh a@b -p password ??? (5 Replies)
How to get the user name of the Operating system from a c program.
eg:-
-rw-r----- 1 gkuser srth1 292 Jul 27 19:28 u1.txt
i need to get gkuser as the result? (3 Replies)