Hi I used the following the following lines to transfer a file "server_config_data_path" to a server to another server, why the mode(permissions) of the file changed? Thanks.
ssh_client = paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
private_key = paramiko.RSAKey.from_private_key_file(private_key_path)
ssh_client.connect(server_ip, username=user, pkey=private_key, timeout=60)
sftp = ssh_client.open_sftp()
sftp.put(config_data_path,server_config_data_path)
The underlying protocol is something along the lines of "open this file on the server" followed by "stuff these bytes in the file". You can specify the attributes if you want (as far as the protocol is concerned), but paramiko doesn't do this. The default openssh implementation won't copy attributes either unless you specify -P/-p.
All that being said, it would be nice if there were a way to specify what the permissions should be. Would be useful for fabric to have secure mode setting.
Most helpful comment
The underlying protocol is something along the lines of "open this file on the server" followed by "stuff these bytes in the file". You can specify the attributes if you want (as far as the protocol is concerned), but paramiko doesn't do this. The default openssh implementation won't copy attributes either unless you specify -P/-p.
All that being said, it would be nice if there were a way to specify what the permissions should be. Would be useful for fabric to have secure mode setting.