scp: no sharing violation while copying
Hi all,
I am doing copies between linux and windows machines using scp.
As soon as a file is being copied (and all the time the copy lasts) on
the target machine, it is readable, deletable without any sharing violation.
How to prevent this behaviour?
Idealy I would like to have the file currently copied locked until the
copy is complete.
Thank in advance.
--
Forje
Re: scp: no sharing violation while copying
Forje <forje.bemac@ialto.com> writes:
[color=blue]
>Hi all,
>I am doing copies between linux and windows machines using scp.
>As soon as a file is being copied (and all the time the copy lasts) on
>the target machine, it is readable, deletable without any sharing violation.
>How to prevent this behaviour?
>Idealy I would like to have the file currently copied locked until the
>copy is complete.[/color]
Locking is a software feature. It is an honour system. If someone really
wants to they can alter a locked file ( just ignore the lock)
However, rsync copies the file to a temporary file first
bugsbunny.Cfj89Kd
until it is copied over and then moves it to the correct location.
Still not perfect, but better.
[color=blue]
>Thank in advance.
>--
>Forje[/color]
Re: scp: no sharing violation while copying
Unruh a écrit :[color=blue]
> Forje <forje.bemac@ialto.com> writes:
>[color=green]
>> Hi all,
>> I am doing copies between linux and windows machines using scp.
>> As soon as a file is being copied (and all the time the copy lasts) on
>> the target machine, it is readable, deletable without any sharing violation.
>> How to prevent this behaviour?
>> Idealy I would like to have the file currently copied locked until the
>> copy is complete.[/color]
>
> Locking is a software feature. It is an honour system. If someone really
> wants to they can alter a locked file ( just ignore the lock)
> However, rsync copies the file to a temporary file first
> bugsbunny.Cfj89Kd
> until it is copied over and then moves it to the correct location.
> Still not perfect, but better.
>[/color]
Thanks for your answer.
I understand that we should in a trusted environment but how can a ssh
server user know that the copy is complete?
--
Forje
Re: scp: no sharing violation while copying
Forje <forje@ialto.com> writes:
[color=blue]
>Unruh a écrit :[color=green]
>> Forje <forje.bemac@ialto.com> writes:
>>[color=darkred]
>>> Hi all,
>>> I am doing copies between linux and windows machines using scp.
>>> As soon as a file is being copied (and all the time the copy lasts) on
>>> the target machine, it is readable, deletable without any sharing violation.
>>> How to prevent this behaviour?
>>> Idealy I would like to have the file currently copied locked until the
>>> copy is complete.[/color]
>>
>> Locking is a software feature. It is an honour system. If someone really
>> wants to they can alter a locked file ( just ignore the lock)
>> However, rsync copies the file to a temporary file first
>> bugsbunny.Cfj89Kd
>> until it is copied over and then moves it to the correct location.
>> Still not perfect, but better.
>>[/color]
>Thanks for your answer.
>I understand that we should in a trusted environment but how can a ssh
>server user know that the copy is complete?[/color]
It does not keep changing in size? scp, just like cp, does not regard it as
a part of its job to let you know that the copy is complete.
As I said, use rsync instead. It sets up a temporary file to transfer the
data (far more efficiently than scp if a prior copy of the file exists
already) and only when the transfer is complete does it rename the file.
[color=blue]
>--
>Forje[/color]
Re: scp: no sharing violation while copying
Unruh a écrit :[color=blue]
> Forje <forje@ialto.com> writes:
>[color=green]
>> Unruh a écrit :[color=darkred]
>>> Forje <forje.bemac@ialto.com> writes:
>>>
>>>> Hi all,
>>>> I am doing copies between linux and windows machines using scp.
>>>> As soon as a file is being copied (and all the time the copy lasts) on
>>>> the target machine, it is readable, deletable without any sharing violation.
>>>> How to prevent this behaviour?
>>>> Idealy I would like to have the file currently copied locked until the
>>>> copy is complete.
>>> Locking is a software feature. It is an honour system. If someone really
>>> wants to they can alter a locked file ( just ignore the lock)
>>> However, rsync copies the file to a temporary file first
>>> bugsbunny.Cfj89Kd
>>> until it is copied over and then moves it to the correct location.
>>> Still not perfect, but better.
>>>[/color]
>> Thanks for your answer.
>> I understand that we should in a trusted environment but how can a ssh
>> server user know that the copy is complete?[/color]
>
> It does not keep changing in size? scp, just like cp, does not regard it as
> a part of its job to let you know that the copy is complete.
>
> As I said, use rsync instead. It sets up a temporary file to transfer the
> data (far more efficiently than scp if a prior copy of the file exists
> already) and only when the transfer is complete does it rename the file.[/color]
I will do some experiments with rsync.
Basically I want to setup a file-based communication (bidirectional)
protocol between two machines in an heterogenous network, windows/linux.
On each side, a process is waiting for files to appear on its own disk.
The problem with scp is that the file apparition is detected as soon as
the copy begins. I don't to enter in timing treatments to know if the
copy is really ended.
--
Forje
Re: scp: no sharing violation while copying
Forje <forje.bemac@ialto.com> wrote:[color=blue]
>Basically I want to setup a file-based communication (bidirectional)
>protocol between two machines in an heterogenous network, windows/linux.
>On each side, a process is waiting for files to appear on its own disk.[/color]
Why are you trying to squeeze this feature onto scp, rather than picking a
transport that fits this methodology better? HTTPS gives you a ton of
flexibility in exactly what you want the server to do before, during, and
after transmission of a message.
[color=blue]
>The problem with scp is that the file apparition is detected as soon as
>the copy begins. I don't to enter in timing treatments to know if the
>copy is really ended.[/color]
Don't use file copies as remote procedure calls. That's not what they're best
at.
--
Mark Rafn [email]dagon@dagon.net[/email] <http://www.dagon.net/>
Re: scp: no sharing violation while copying
Forje <forje.bemac@ialto.com> writes:
[color=blue]
>Unruh a écrit :[color=green]
>> Forje <forje@ialto.com> writes:
>>[color=darkred]
>>> Unruh a écrit :
>>>> Forje <forje.bemac@ialto.com> writes:
>>>>
>>>>> Hi all,
>>>>> I am doing copies between linux and windows machines using scp.
>>>>> As soon as a file is being copied (and all the time the copy lasts) on
>>>>> the target machine, it is readable, deletable without any sharing violation.
>>>>> How to prevent this behaviour?
>>>>> Idealy I would like to have the file currently copied locked until the
>>>>> copy is complete.
>>>> Locking is a software feature. It is an honour system. If someone really
>>>> wants to they can alter a locked file ( just ignore the lock)
>>>> However, rsync copies the file to a temporary file first
>>>> bugsbunny.Cfj89Kd
>>>> until it is copied over and then moves it to the correct location.
>>>> Still not perfect, but better.
>>>>
>>> Thanks for your answer.
>>> I understand that we should in a trusted environment but how can a ssh
>>> server user know that the copy is complete?[/color]
>>
>> It does not keep changing in size? scp, just like cp, does not regard it as
>> a part of its job to let you know that the copy is complete.
>>
>> As I said, use rsync instead. It sets up a temporary file to transfer the
>> data (far more efficiently than scp if a prior copy of the file exists
>> already) and only when the transfer is complete does it rename the file.[/color][/color]
[color=blue]
>I will do some experiments with rsync.
>Basically I want to setup a file-based communication (bidirectional)
>protocol between two machines in an heterogenous network, windows/linux.
>On each side, a process is waiting for files to appear on its own disk.
>The problem with scp is that the file apparition is detected as soon as
>the copy begins. I don't to enter in timing treatments to know if the
>copy is really ended.[/color]
So, have the remote system copy the file to a tmp filename, and when it
finishes, move it to the filename that the other side is waiting for ( as
rsync does, but you can do it as well.)
export A=filename.$$
scp filename remote:$A
ssh remote mv -f $A filename
[color=blue]
>-- O
>Forje[/color]
Re: scp: no sharing violation while copying
Mark Rafn a écrit :[color=blue]
> Forje <forje.bemac@ialto.com> wrote:[color=green]
>> Basically I want to setup a file-based communication (bidirectional)
>> protocol between two machines in an heterogenous network, windows/linux.
>> On each side, a process is waiting for files to appear on its own disk.[/color]
>
> Why are you trying to squeeze this feature onto scp, rather than picking a
> transport that fits this methodology better? HTTPS gives you a ton of
> flexibility in exactly what you want the server to do before, during, and
> after transmission of a message.
>[/color]
I agree with you. We plan to implement webservices in future.
[color=blue][color=green]
>> The problem with scp is that the file apparition is detected as soon as
>> the copy begins. I don't to enter in timing treatments to know if the
>> copy is really ended.[/color]
>
> Don't use file copies as remote procedure calls. That's not what they're best
> at.[/color]
Yes, it's dirty but quick...
--
Forje
Re: scp: no sharing violation while copying
Unruh a écrit :[color=blue]
> Forje <forje.bemac@ialto.com> writes:
>[color=green]
>> Unruh a écrit :[color=darkred]
>>> Forje <forje@ialto.com> writes:
>>>
>>>> Unruh a écrit :
>>>>> Forje <forje.bemac@ialto.com> writes:
>>>>>
>>>>>> Hi all,
>>>>>> I am doing copies between linux and windows machines using scp.
>>>>>> As soon as a file is being copied (and all the time the copy lasts) on
>>>>>> the target machine, it is readable, deletable without any sharing violation.
>>>>>> How to prevent this behaviour?
>>>>>> Idealy I would like to have the file currently copied locked until the
>>>>>> copy is complete.
>>>>> Locking is a software feature. It is an honour system. If someone really
>>>>> wants to they can alter a locked file ( just ignore the lock)
>>>>> However, rsync copies the file to a temporary file first
>>>>> bugsbunny.Cfj89Kd
>>>>> until it is copied over and then moves it to the correct location.
>>>>> Still not perfect, but better.
>>>>>
>>>> Thanks for your answer.
>>>> I understand that we should in a trusted environment but how can a ssh
>>>> server user know that the copy is complete?
>>> It does not keep changing in size? scp, just like cp, does not regard it as
>>> a part of its job to let you know that the copy is complete.
>>>
>>> As I said, use rsync instead. It sets up a temporary file to transfer the
>>> data (far more efficiently than scp if a prior copy of the file exists
>>> already) and only when the transfer is complete does it rename the file.[/color][/color]
>[color=green]
>> I will do some experiments with rsync.
>> Basically I want to setup a file-based communication (bidirectional)
>> protocol between two machines in an heterogenous network, windows/linux.
>> On each side, a process is waiting for files to appear on its own disk.
>> The problem with scp is that the file apparition is detected as soon as
>> the copy begins. I don't to enter in timing treatments to know if the
>> copy is really ended.[/color]
>
> So, have the remote system copy the file to a tmp filename, and when it
> finishes, move it to the filename that the other side is waiting for ( as
> rsync does, but you can do it as well.)
> export A=filename.$$
> scp filename remote:$A
> ssh remote mv -f $A filename
>[/color]
That's what I will do for the moment.
Thanks again to Unruh and Mark.
--
Forje