I have written a script that downloads two files via sftp. In the next step I want the script to change the rights of the files. I use pysftp for downloading the files from the sever and then I use ssh.sendLine command to send the chmod command. Unfortunately this changes BOTH files to 644 instead of 600 for the cert file. If I manually type "chmod 600 key" into Terminal after running the script it changes accordingly.
I use the following code:
ssh.sendline("get file1 /home/appadmin/key")
ssh.sendline("get file2 /home/appadmin/cert")
ssh.sendline("cd /home/appadmin/")
ssh.sendline("chmod 644 cert")
ssh.sendline("chmod 600 key")