I am writing a shell script that can connect to another remote machine and query the DB , write the result in a file and copy the file back to main machine. I am facing issue while connecting to DB. I am not understanding how to connect to the remote machine. I am using ssh root@DB_IP the then ORACLE query. But its always asking a password. How to provide both username and password while doing a ssh to the remote machine?
            Asked
            
        
        
            Active
            
        
            Viewed 266 times
        
    0
            
            
        - 
                    1Possible duplicate of [Automatically Enter SSH Password With Script](http://stackoverflow.com/questions/12202587/automatically-enter-ssh-password-with-script) – Kenster Dec 22 '15 at 12:48
 
1 Answers
0
            
            
        You can do this by two ways:-
- By adding your id.rsa.pub in your remote machine (~/.ssh/authorized_keys)
 sshpass -p password ssh root@ip "sh run.sh "
        Pratik Anand
        
- 667
 - 5
 - 11