File permissions - windows to unix

Advertisement

robatwork
Joined:
Posts:
6
Location:
UK

File permissions - windows to unix

Hi,
I am uploading a file (both with a script and manually in winscp) from a windows server to a unix server.

No matter what options I choose in Preferences/Transfer, I always get the file transferred as rw-r--r--

I can manually change permission however to eg rwxr-xr-x

If I manually change permissions, the upload the same file again and overwrite, then the changed permissions stay. If I delete the file then upload, it goes back to rw-r--r--

Any ideas how I can force permissions automatically or why it isn't working?

Am using 4.2.2 build 480

many thanks
Rob

Reply with quote

Advertisement

robatwork
Joined:
Posts:
6
Location:
UK

Follow up - I have discovered the permission= option inthe script, but it doesn't seem to work:

Synchronize remote -mirror -delete -criteria=size -permissions=755

This does the synchronize but permission of the files are still rw-r-r ie 644

Any ideas what I am doing incorrectly?

(Having searched for similar problems I think this issue should be moved to the scripting forum please)
thanks

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,517
Location:
Prague, Czechia

Re: File permissions - windows to unix

Please post a full log file showing the problem.

To generate log file, enable logging, log in to your server and do the operation and only the operation that causes the error. For posting extensive logs you may use pastebin or similar application. 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 may email it to me. You will find my address (if you log in) in my forum profile. Please include link back to this topic in your email. Also note in this topic that you have emailed the log.

Reply with quote

robatwork
Joined:
Posts:
6
Location:
UK

Hi - here is the log:


. 2009-12-03 08:13:09.593 --------------------------------------------------------------------------
. 2009-12-03 08:13:09.593 WinSCP Version 4.2.2 (Build 480) (OS 5.2.3790 Service Pack 1)
. 2009-12-03 08:13:09.593 Login time: 03 December 2009 08:13:09
. 2009-12-03 08:13:09.593 --------------------------------------------------------------------------
. 2009-12-03 08:13:09.593 Session name: test_ftp
. 2009-12-03 08:13:09.593 Host name: xxx(Port: 21)
. 2009-12-03 08:13:09.593 User name: xxx(Password: Yes, Key file: No)
. 2009-12-03 08:13:09.593 Tunnel: No
. 2009-12-03 08:13:09.593 Transfer Protocol: FTP
. 2009-12-03 08:13:09.593 Ping type: C, Ping interval: 30 sec; Timeout: 60 sec
. 2009-12-03 08:13:09.593 Proxy: none
. 2009-12-03 08:13:09.593 FTP: FTPS: None; Passive: Yes
. 2009-12-03 08:13:09.593 Local directory: c:\test_ftp, Remote directory: /httpdocs/upload/images/test_ftp, Update: No, Cache: Yes
. 2009-12-03 08:13:09.593 Cache directory changes: Yes, Permanent: Yes
. 2009-12-03 08:13:09.593 DST mode: 1
. 2009-12-03 08:13:09.593 --------------------------------------------------------------------------
. 2009-12-03 08:13:09.593 Connecting to hughrice.net ...
. 2009-12-03 08:13:09.656 Connected with hughrice.net. Waiting for welcome message...
< 2009-12-03 08:13:09.812 220 ProFTPD 1.3.1 Server (ProFTPD) [192.168.1.175]
> 2009-12-03 08:13:09.812 USER xxxxx
< 2009-12-03 08:13:09.968 331 Password required for xxxxx
> 2009-12-03 08:13:09.968 PASS ********
< 2009-12-03 08:13:10.140 230 User xxxxxx logged in
> 2009-12-03 08:13:10.140 SYST
< 2009-12-03 08:13:10.218 215 UNIX Type: L8
> 2009-12-03 08:13:10.218 FEAT
< 2009-12-03 08:13:10.234 211-Features:
< 2009-12-03 08:13:10.234 MDTM
< 2009-12-03 08:13:10.234 REST STREAM
< 2009-12-03 08:13:10.234 SIZE
< 2009-12-03 08:13:10.375 211 End
. 2009-12-03 08:13:10.375 Connected
. 2009-12-03 08:13:10.375 --------------------------------------------------------------------------
. 2009-12-03 08:13:10.375 Using FTP protocol.
. 2009-12-03 08:13:10.375 Doing startup conversation with host.
> 2009-12-03 08:13:10.375 PWD
< 2009-12-03 08:13:10.390 257 "/" is the current directory
. 2009-12-03 08:13:10.390 Changing directory to "/httpdocs/upload/images/test_ftp".
> 2009-12-03 08:13:10.390 CWD /httpdocs/upload/images/test_ftp
< 2009-12-03 08:13:10.406 250 CWD command successful
. 2009-12-03 08:13:10.406 Getting current directory name.
> 2009-12-03 08:13:10.406 PWD
< 2009-12-03 08:13:10.437 257 "/httpdocs/upload/images/test_ftp" is the current directory
. 2009-12-03 08:13:10.437 Startup conversation with host finished.
. 2009-12-03 08:13:10.437 Collecting synchronization list for local directory 'c:\test_ftp' and remote directory '/httpdocs/upload/images/test_ftp', mode = 0, params = 5635
. 2009-12-03 08:13:10.437 Retrieving directory listing...
> 2009-12-03 08:13:10.437 TYPE A
< 2009-12-03 08:13:10.453 200 Type set to A
> 2009-12-03 08:13:10.453 PASV
< 2009-12-03 08:13:10.468 227 Entering Passive Mode (78,136,8,75,145,60).
> 2009-12-03 08:13:10.468 LIST -a
< 2009-12-03 08:13:10.515 150 Opening ASCII mode data connection for file list
< 2009-12-03 08:13:10.703 226-Transfer complete
< 2009-12-03 08:13:10.703 226 Quotas off
. 2009-12-03 08:13:10.703 Directory listing successful
. 2009-12-03 08:13:10.703 Synchronizing local directory 'c:\test_ftp\' with remote directory '/httpdocs/upload/images/test_ftp/', params = 5635
. 2009-12-03 08:13:10.703 Deleting file "/httpdocs/upload/images/test_ftp/67-04-002.jpg".
> 2009-12-03 08:13:10.703 DELE /httpdocs/upload/images/test_ftp/67-04-002.jpg
< 2009-12-03 08:13:10.718 250 DELE command successful
. 2009-12-03 08:13:10.718 Copying 1 files/directories to remote directory "/httpdocs/upload/images/test_ftp/"
. 2009-12-03 08:13:10.718 PrTime: Yes; PrRO: No; Rght: rwxrwxrwx; PrR: Yes (No); FnCs: N; RIC: 01; Resume: S (102400); CalcS: No; Mask: *.*
. 2009-12-03 08:13:10.718 TM: M; ClAr: Yes; CPS: 0; ExclM(No):
. 2009-12-03 08:13:10.718 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2009-12-03 08:13:10.734 File: "c:\test_ftp\Blank.txt"
. 2009-12-03 08:13:10.734 Copying "c:\test_ftp\Blank.txt" to remote directory started.
. 2009-12-03 08:13:10.734 Ascii transfer mode selected.
. 2009-12-03 08:13:10.734 Starting upload of c:\test_ftp\Blank.txt
> 2009-12-03 08:13:10.734 TYPE A
< 2009-12-03 08:13:10.750 200 Type set to A
> 2009-12-03 08:13:10.750 PASV
< 2009-12-03 08:13:10.765 227 Entering Passive Mode (78,136,8,75,155,114).
> 2009-12-03 08:13:10.765 STOR Blank.txt
< 2009-12-03 08:13:10.812 150 Opening ASCII mode data connection for Blank.txt
< 2009-12-03 08:13:11.031 226 Transfer complete
. 2009-12-03 08:13:11.031 Upload successful
. 2009-12-03 08:13:11.031 Disconnected from server

After the transfer the directory looks like this:
<invalid hyperlink removed by admin>
sorry it didn't upload well but you can see the permissions are rw-r--r-- on the two files uploaded.

Here is the batch file that initiates the transfer:

winscp.exe /console /script=ftp.txt /log=c:\log.txt

and here is ftp.txt:
option batch on
option confirm off
open test_ftp
Synchronize remote -mirror -permissions=777 -delete -criteria=size
exit

Many thanks for any help you can offer

Reply with quote

robatwork
Joined:
Posts:
6
Location:
UK

Follow Up:
Using the parameters above I uploaded to a folder with some existing files. The ones that were already there were updated, and kept their rwxrwxrwx permissions. The brand new files still got rw-r--r--

Can you help please?
thanks

Reply with quote

Advertisement

martin
Site Admin
martin avatar

I wasn't aware that you use FTP protocol. With FTP the option is not supported for put command. I have updated documentation to reflect that. You can use chmod command though.

Reply with quote

Advertisement

You can post new topics in this forum