scp: no sharing violation while copying - SSH

This is a discussion on scp: no sharing violation while copying - SSH ; 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. ...

+ Reply to Thread
Results 1 to 9 of 9

Thread: scp: no sharing violation while copying

  1. 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

  2. Re: scp: no sharing violation while copying

    Forje 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.


    >Thank in advance.
    >--
    >Forje


  3. Re: scp: no sharing violation while copying

    Unruh a écrit :
    > Forje 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?
    --
    Forje

  4. Re: scp: no sharing violation while copying

    Forje writes:

    >Unruh a écrit :
    >> Forje 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.

    >--
    >Forje


  5. Re: scp: no sharing violation while copying

    Unruh a écrit :
    > Forje writes:
    >
    >> Unruh a écrit :
    >>> Forje 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.


    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

  6. Re: scp: no sharing violation while copying

    Forje wrote:
    >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.


    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.

    >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.


    Don't use file copies as remote procedure calls. That's not what they're best
    at.
    --
    Mark Rafn dagon@dagon.net

  7. Re: scp: no sharing violation while copying

    Forje writes:

    >Unruh a écrit :
    >> Forje writes:
    >>
    >>> Unruh a écrit :
    >>>> Forje 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.


    >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.


    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

    >-- O
    >Forje


  8. Re: scp: no sharing violation while copying

    Mark Rafn a écrit :
    > Forje wrote:
    >> 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.

    >
    > 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.
    >

    I agree with you. We plan to implement webservices in future.

    >> 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.

    >
    > Don't use file copies as remote procedure calls. That's not what they're best
    > at.

    Yes, it's dirty but quick...
    --
    Forje

  9. Re: scp: no sharing violation while copying

    Unruh a écrit :
    > Forje writes:
    >
    >> Unruh a écrit :
    >>> Forje writes:
    >>>
    >>>> Unruh a écrit :
    >>>>> Forje 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.

    >
    >> 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.

    >
    > 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
    >

    That's what I will do for the moment.
    Thanks again to Unruh and Mark.
    --
    Forje

+ Reply to Thread