I am trying to navigate to a folder in my linux box and update a file using paramiko.
Here do I need to enter all the commands at once by separating with ';' or is there any way to maintain a session.
Could you please suggest with the same.
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('1.1.1.1',username='abc',password='bnw')
cmd = 'cd rtg-demo/app-demo;pwd'
stdin, stdout, stderr = ssh.exec_command(cmd)
print(stdout.readlines())
stdin, stdout, stderr = ssh.exec_command('pwd')
print(stdout.readlines())
Here for the first print statement I am getting the correct path to which I have navigated. But for second print statement, I am seeing the home directory path.
Output is as below
['/remote/users/abc/rtg-demo/app-demo\n']
['/remote/users/abc\n']