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 ???

try this

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

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?

Not valid for SSH. Instead, you could use digital certificates so that SSH doesn't ask you for a password.

Hi,

For SSH to work without password you need to create the hash Keys and copy the same into the client and server.

You could try "EXPECT" tool for the automation of the script.
else automate the login using Certificates(Public,Private Keys authentication).