0

I'm looking for a command that allows me to securely move a file or directory.

If it doesn't exist, is my only option to write a shell script that

  1. securely copies the item to the destination
  2. compares source and destination
  3. securely deletes the source
  • 1
    What do you mean by "securely" here? What problem are you wanting to solve that regular cp or mv fails at? – BowlOfRed Sep 29 '17 at 1:31
  • I need to make sure that the original file is mainly securely deleted such as with srm after the move, but having a secure copy (using ssh for the data transfer) would improve the solution even more. – Alex Ixeras Sep 29 '17 at 1:39
1

I think rsync matches with your desired command. rsync is a fast and extraordinarily versatile file copying tool. For More Info Look Here

  • I had a look at rsync, but it doesn't seem to have an option for securely syncing files. Also, AFAIK rsync copies (syncs) files, but doesn't really move them as such. – Alex Ixeras Sep 29 '17 at 0:12
  • @AlexIxeras rsync often runs inside ssh, so it is protected from viewing or modifications over the wire when that happens. With the --remove-source-files option, it will delete the source side after the transfer is complete. – BowlOfRed Sep 29 '17 at 2:36
  • @BowlOfRed Ok, so I need to wrap the execution of rsync in ssh, but does the remove-source-files option also securely remove, ie. wipe/overwrite, the source file? – Alex Ixeras Sep 29 '17 at 2:40
  • @AlexIxeras, you don't need to wrap it. The standard method of running it will use ssh if you specify a remote source or remote destination. It simply issues a normal delete. (Not all filesystems will do anything useful if you try to overwrite a file the way srm attempts to do it) – BowlOfRed Sep 29 '17 at 2:54
  • @BowlOfRed My initial use case for a "secure move" was to move files locally, but ensuring that the original file gets securely deleted. — I should've clarified the "overwrite": I'm aware that srm works differently to a simple overwrite (and most of the time I need to use the -mz option). I just needed to word it. – Alex Ixeras Sep 29 '17 at 3:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.