username password in script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting username password in script
# 1  
Old 02-13-2007
username password in script

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 ???
# 2  
Old 02-13-2007
try this

Code:
(sleep 5; echo user_name; sleep 6; password; sleep 9; echo "do something"; 
sleep 8; echo "exit") | telnet server_name

# 3  
Old 02-13-2007
no use...

just wanna try something else....when i use ssh username@hostname and execute the script...i am getting a password prompt...is it possible to write something that reads the passowrd from the script?
# 4  
Old 02-13-2007
Quote:
Originally Posted by srikanthus2002
try this

Code:
(sleep 5; echo user_name; sleep 6; password; sleep 9; echo "do something"; 
sleep 8; echo "exit") | telnet server_name

Not valid for SSH. Instead, you could use digital certificates so that SSH doesn't ask you for a password.
# 5  
Old 02-13-2007
Hi,

For SSH to work without password you need to create the hash Keys and copy the same into the client and server.
# 6  
Old 02-13-2007
You could try "EXPECT" tool for the automation of the script.
else automate the login using Certificates(Public,Private Keys authentication).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing Username & password through shell script to java code

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)
Discussion started by: rakeshtomar82
1 Replies

2. Shell Programming and Scripting

How to send Two different password in Single script, having same username..?

Hi Team, i want to input two password for single node like pass1/pass2 one of the pass1 is working some node and pass2 is working for some nodes . For nodes having pass1 i have to run different script and for nodes having pass2 i have to run different script Sooo how can put two pass... (3 Replies)
Discussion started by: Ganesh Mankar
3 Replies

3. UNIX for Dummies Questions & Answers

Script to log in SFTP server [with username, password]

Hi, everyone, I am trying to write a script to login automatically using username and password to an sftp server (the key authentication has been disabled so I cannot use that method). I tried to search online for a solution and found a way using "expect" but my boss does not want me to use... (4 Replies)
Discussion started by: warmboy610
4 Replies

4. Shell Programming and Scripting

Passing username and password to a script running inside "expect" script

Hi I'm trying to run a script " abc.sh" which triggers "use.sh" . abc.sh is nothing but a "expect" script which provides username and password automatically to the use.sh script. Please find below the scripts: #abc.sh #!/usr/bin/expect -f exec /root/use.sh expect "*name*" send... (1 Reply)
Discussion started by: baddykam
1 Replies

5. UNIX for Dummies Questions & Answers

How do you reset username/password

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)
Discussion started by: TanRuNomad
2 Replies

6. Shell Programming and Scripting

Username and password

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)
Discussion started by: somersetdan
5 Replies

7. Shell Programming and Scripting

Asking username and password in the middle of the Shell/perl script

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)
Discussion started by: pareshpatra
1 Replies

8. UNIX for Dummies Questions & Answers

How can i hide username/password

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)
Discussion started by: temhem
1 Replies

9. UNIX for Dummies Questions & Answers

Shell program with username and password

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... (7 Replies)
Discussion started by: thedemonhunter
7 Replies

10. Solaris

i wanto hardcode password for a username to ssh to a server using script

Dear all i want to ssh to a server via running a shell script with a username and i want to hard code the password for that particular username can u help me please Thank u Naree (8 Replies)
Discussion started by: naree
8 Replies
Login or Register to Ask a Question