Topic "Any way to preserve mode bits?"

Author Message
mj
[View user's profile]

Joined: 2014-07-23
Posts: 10
Location: United States
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?
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
WinSCP should do think by default with SFTP protocol. Are you using FTP?
_________________
Martin Prikryl
mj
[View user's profile]

Joined: 2014-07-23
Posts: 10
Location: United States
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?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
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.
mj
[View user's profile]

Joined: 2014-07-23
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

Description: (none)

mj-sftp@88.232.173.86.log (74.51 KB) Private file

Description: (none)

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Could you name a single file I should be looking for (a one that existed before the transfer)?
_________________
Martin Prikryl
mj
[View user's profile]

Joined: 2014-07-23
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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
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?
mj
[View user's profile]

Joined: 2014-07-23
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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Actually, having second look at the log, I would be interested in seeing Debug 2-level.
See https://winscp.net/eng/docs/ui_pref_logging
Can you create a temp folder, with one file with some permissions set; and produce a session log showing, how you login, list that directory contents and overwrite the file?
mj
[View user's profile]

Joined: 2014-07-23
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?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
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?
_________________
Martin Prikryl
mj
[View user's profile]

Joined: 2014-07-23
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.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License