Reputation:
I want to login to remote computer using shell script through ssh, i want to pass username and password from text file. how to do that?
here is code what i have tried.
#!/bin/sh
#
username=user
ip=192.168.2.21
ssh $username@$ip < user.txt
Upvotes: 1
Views: 1833
Reputation:
You can't SSH in the method that you're referring to. You will want to use SSH keys which are created to help with what you're doing.
Also, avoid storing your password in a text file.
Upvotes: 1