Any way to preserve mode bits?

Advertisement

mj
Joined:
Posts:
10
Location:
United States

Any way to preserve mode bits?

I've looked through the documentation but I haven't found a way to preserve a file's mode bits on the remote node following a copy. Is that possible with WinSCP?

Reply with quote

Advertisement

mj

Hi prikryl,

Thanks for replying. I tried both sftp and scp. Neither preserved the mode values. Does ftp work differently than sftp in this regard?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Please attach a full log file showing the problem (using the latest version of WinSCP and SFTP protocol).

To generate log file, enable logging, log in to your server and do the operation and only the operation that causes the error. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

mj
Joined:
Posts:
10
Location:
United States

I have attached the log file as well as an 'll' listing of the local directory which was copied so that you can see the original mode values (file permissions). Note that the local machine is a Windows 7 system.

Thanks.
  • local-ll.log (2.59 KB, Private file)
  • mj-sftp@88.232.173.86.log (74.51 KB, Private file)

Reply with quote

Advertisement

mj
Joined:
Posts:
10
Location:
United States

Hi prikryl, "AmIHome.ksh" is a file on the local system with execute privileges. But after the transfer to the remote node, the permissions were set to 664.

You can probably tell from the log, but I did not have the "Set permissions" flag set for the copy operation.

Thanks.

Reply with quote

martin
Site Admin
martin avatar

Log for that file looks good.
I cannot reproduce your problem. When I connect to OpenSSH SFTP server on Ubuntu, permissions are preserved. Is there some unusual file system that you are writing the files to?

Reply with quote

mj
Joined:
Posts:
10
Location:
United States

> Is there some unusual file system that you are writing the files to?

I don't *think* so. It's an ext4 file system. However, I am using Amazon Web Services to create a machine image, and I am using Amazon's EBS for the storage. In practice, it is supposed to work just like any other non-virtual system.

In any case, thanks for looking into the logs for me. I'll have to come up with a workaround I suppose because I have far too many files to chmod "manually". Perhaps I will make use of tar/cpio or something. Not an ideal solution, unfortunately.

Reply with quote

Advertisement

mj
Joined:
Posts:
10
Location:
United States

Hopefully I have not misled you. Let me address your latest request first... I did the experiment as you stated and in that case the file permissions did not change. That is, I first chmod'd the permissions on the remote file and then overwrote it. Following the copy, the remote file's permissions did not change. Given that, do you still want the log?

Now, the original issue I was trying to explain is that if I copy a file to the remote node that did not previously exist on the remote node, the file permissions on the remote node following the copy do not match the permissions on the local node. Rather, the permissions on the remote node's file are set to a default of 664 . If that is expected, then the functionality I was hoping for is not possible. And I will have to make use of tar/cpio. So, is this scenario operating as you would expect?

Reply with quote

martin
Site Admin
martin avatar

OK, so I missed the point then.

What permissions on local node do you mean? WinSCP is Windows application. Or are you running it on *nix under Wine?

Reply with quote

mj
Joined:
Posts:
10
Location:
United States

My apologies for not being clearer in my initial post.

Regarding "permissions on the local node": I _am_ running on a Windows platform. However, I have been using unix-like commands on my PC "forever"; thus, 'ls -l' actually shows permissions. But I'm not even sure what they map to in the Windows world. So it seems I overlooked native Windows functionality when I asked that permissions be presevered--I see now that my request is not applicable. Thanks for your help; and I apologize for any inconvenience.

Reply with quote

Advertisement

You can post new topics in this forum