I am trying to execute command to create DB in the remote machine using Robotframework SSH which will throw an privileged error. But if I try to run same command over PUTTY application or using Paramiko library it will work seamless. How can I fix this issue?
Firstly I tried to execute command directly through putty application and it is executing properly. But when I execute in python Shell using SSHLibrary it will throw following error.
from SSHLibrary import SSHLibrary # library from Robotframework
ob=SSHLibrary()
ob.open_connection("192.168.5.10")
ob.login("Administrator","Password")
print ob.execute_command("db2 create db test7")
Output will be::
u'SQL1092N The requested command or operation failed because the user ID
does \r\r\nnot have the authority to perform the requested command or
operation. User \r\r\nID: "LOCAL SERVICE".\r\r'
If I execute this above command directly using paramiko library it will successfully create database This is the working code :
import paramiko
c=paramiko.Transport(('192.168.5.10',22))
c.connect(username='Administrator',password='Password')
sess=c.open_channel(kind='session')
sess.exec_command('db2 create db test7')
print sess.recv(4096)
output will be:
DB20000I The CREATE DATABASE command completed successfully.
Though SSHLibrary internally dependent on paramiko library it self, it fails to execute the command. But if I use paramiko library directly it will execute properly as like putty application. I wonder how its not working from Robot SSHLibrary. Someone please help me in fixing this issue...
Note: remote machine is windows with cygwin installed to enable SSH!