Comments (10)
Thanks for reporting these issues.
I will add command line options and look into the time/date issue with rsync.
from cppcryptfs.
I've added command line options. Please see the README.md for usage.
I did a quick test with rsync, and I don't see the problem.
I mounted a filesystem on k: and then did
rsync -avP . /cygdrive/k/foo/
And the file times/dates were preserved (the files were from August).
from cppcryptfs.
Thank you very much for the commandline update. For the date/time - That was my fault - The problem is amazon cloud drive not cppcryptfs - It seems that Amazon can't handle date/time correct. Sry for this.
The --tray and --exit options are really useful too - THX 👍
from cppcryptfs.
A little issue with the commandline options:
the commandline/cppcryptfs blocks if used in batch/script
Sample:
cppcryptfs --unmount=u --tray --exit
cppcryptfs.exe --mount=d:\TestCryptCppFS --drive=u --password=PASSWORD --tray --exit
robocopy C:\test.txt U:\test.txt
if I use this sample as batch file the second line (cppcryptfs.exe --mount) blocks until cppcryptfs exits. This prevent use of batch files or multiple mounting in scripts.
Sample for a backup batch thats breaks on line 3 (first call of cppcryptfs.exe --mount):
cppcryptfs --unmount=u --tray --exit
cppcryptfs --unmount=v --tray --exit
cppcryptfs.exe --mount=d:\TestCryptCppFS --drive=u --password=PASSWORD --tray --exit
cppcryptfs.exe --mount=d:\TestCryptCppFS2 --drive=v --password=PASSWORD --tray --exit
robocopy C:\test.txt U:\test.txt
robocopy C:\test.txt V:\test.txt
cppcryptfs --unmount=u --tray --exit
cppcryptfs --unmount=v --tray --exit
from cppcryptfs.
The way an instance of cppcryptfs deals with command line options is like this:
If there is no instance of cppcryptfs already running, then it processes the command line options itself.
If there is another instance already running, then the second instance of cppcryptfs sends the command line to the first instance and blocks until the first instance is done processing the command line options (e.g. the mount operation completes). The first instance will redirect its stderr and stdout to the console of the second instance, so you can see any error messages it prints.
If you run cppcryptfs or most other windows gui apps (e.g. notepad) from cygwin bash, they will block until exit unless you run them in the background with &
I worked around the blocking problem in the bash example in the readme by starting an instance of cppcryptfs in the background before doing anything else.
#!/bin/bash
# start cppcryptfs in the background and hidden in the system tray
/cygdrive/c/bin/cppcryptfs -t &
# give it time to initialize
sleep 1
# mount a filesystem and wait for the mount operation to complete
/cygdrive/c/bin/cppcryptfs --mount c:\\tmp\\test -d k -p XYZ
# do backup operation
rsync .....
# unmount all drives and exit
./cppcryptfs -u all -x
The second instance of cppcryptfs will tell the background instance to do the mount, and it will exit when the mount operation is completed so the script can continue.
Would this technique work in your case?
from cppcryptfs.
Thank you for your quick answer
The way you describe seems correct - Blocking until the command is processed make sense - But cppcryptfs should release lock if the commandline parameter is done (e.g. if the drive is mounted/unmounted it should release lock and accept next command and free the console). The same way e.g. TrueCrypt/VeraCrypt works.
The problem with lock is that's not possible to mount multiple drives in one script/batch (see my second example).
It should be possible to open a cmd.exe or bash and open cppcryptfs from there without exit the main process to make it possible to run in a init script or in windows task schedule (batch)
I want to add a batch to windows autostart like this:
@echo ====================================================
@echo Dismount mounted drives - ignore errors
@echo ====================================================
cppcryptfs --unmount=u --tray --exit
cppcryptfs --unmount=v --tray --exit
@echo ====================================================
@echo Mount drive U:
@echo ====================================================
cppcryptfs.exe --mount=d:\TestCryptCppFS --drive=u --password=PASSWORD --tray --exit
@echo ====================================================
@echo Mount drive V:
@echo This will not work until first instance in closed
@echo ====================================================
cppcryptfs.exe --mount=d:\TestCryptCppFS2 --drive=v --password=PASSWORD --tray --exit
@echo ====================================================
@echo Run any command with the mounted drives
@echo ====================================================
robocopy C:\test.txt U:\test.txt
robocopy C:\test.txt V:\test.txt
from cppcryptfs.
I found out something I never noticed before.
If you start a windows gui app in a command shell, it doesn't block. But if you start it in a batch file, it does block.
I got your backup script to work.
I started a cppcryptfs instance in the background with "start" and run the others (that talk to it) with "start /wait" . It seems to work.
The robocopy commands didn't work. I think it wants to copy only directories. So I changed them to plain copies.
@echo ====================================================
@echo Dismount mounted drives - ignore errors
@echo ====================================================
start /wait cppcryptfs --unmount=u --tray --exit
start /wait cppcryptfs --unmount=v --tray --exit
@echo ====================================================
@echo run cppcryptfs in background and give it time to startup
@echo ====================================================
start cppcryptfs.exe --tray
timeout /t 1 >nul
@echo ====================================================
@echo Mount drive U:
@echo ====================================================
start /wait cppcryptfs.exe --mount=d:\TestCryptCppFS --drive=u --password=PASSWORD --tray --exit
@echo ====================================================
@echo Mount drive V:
@echo Should work now
@echo ====================================================
start /wait cppcryptfs.exe --mount=d:\TestCryptCppFS2 --drive=v --password=PASSWORD --tray --exit
@echo ====================================================
@echo Run any command with the mounted drives
@echo ====================================================
copy C:\test.txt U:\test.txt
copy C:\test.txt V:\test.txt
Is this ok?
from cppcryptfs.
This method works partially - It will mount multiple drives and copy the files - But the commandline window don't close after the batch is done... If I use this command on windows autostart the drives get mounted and the copy command will successfully complete but commandline dont disappear until i close cppcryptfs.
It's possible to wrap this into a shell execute and start a hidden commandline but I think many users will get mount their drives on autostart and a batch file is the most easy method to get this done. If shell execute is used the user need to script something in C#/Python/VBScript...
from cppcryptfs.
I think I found the problem.
It looks like the cmd window was hanging around because cppcryptfs (the one that keeps running in the background) was holding open the stderr and stdout from the invoking cmd window.
I made it close stderr and stdout and then free the console after processing the command line.
Before processing the command line options, it attaches to the console and reopens stderr and stdout from that console. So the error messages keep working. But now it closes everything after finishing the command line options processing.
Now when I run the above batch file from a shortcut on the desktop, the window closes automatically when it finishes. It wasn't closing before, like you said.
Please try it and let me know if it solves the problem.
from cppcryptfs.
Great: With this change I'm able to run cppcryptfs in batchfiles, autostart and shellscripts- Commandline window will close after successfully run :-)
@echo ====================================================
@echo Dismount mounted drives - ignore errors
@echo ====================================================
cppcryptfs --unmount=u --tray --exit
cppcryptfs --unmount=v --tray --exit
@echo ====================================================
@echo run cppcryptfs in background and give it time to startup
@echo ====================================================
start cppcryptfs.exe --tray
timeout /t 1 >nul
@echo ====================================================
@echo Mount drive U:
@echo ====================================================
cppcryptfs.exe --mount=d:\TestCryptCppFS --drive=u --password=PASSWORD --tray --exit
@echo ====================================================
@echo Mount drive V:
@echo ====================================================
cppcryptfs.exe --mount=d:\TestCryptCppFS2 --drive=v --password=PASSWORD --tray --exit
@echo ====================================================
@echo Run any command with the mounted drives
@echo ====================================================
copy C:\test.txt U:\test.txt
copy C:\test.txt V:\test.txt
Thank you
from cppcryptfs.
Related Issues (20)
- Detected as Malware on BitDefender HOT 5
- High CPU load
- reproducible lost file case (temporary) HOT 4
- Unauthorized Internet connection HOT 2
- Copy file to google drive thrown exception
- Gocryptfs with scryptn >16 is not compatible HOT 3
- Add note to encrypt pagefile on Windows HOT 1
- Question: is CppCryptFs (& GoCryptfs) capable for holding mountable Virtual Drives & containers (.vmdk, .vhd, .vhdx, .img etc) HOT 1
- absolutely cant use !!!!
- Moving from DIRIV to DETERMINISTIC
- Add extension to encrypted file. HOT 4
- Unable to open pipe. lastErr = 2 The system cannot find the file specified. Is cppcryptfs running?
- any tool to get back the filename from an encrypted file+filename, provided i got the .diriv file on hand? HOT 1
- Popup "Dokany version 2.1.0.1000 has not been tested"- no problems so far, option to disable popup
- Unmount on close? HOT 1
- ERROR C:\git\cppcryptfs\x64\Release\cppcryptfs.exe The system cannot find the files specifed
- Taskbar tray icon disappears on Windows Explorer crash
- Feature Request for Reverse Mode: Content-Defined Chunking
- Connect with a Key Management System (KMS)
- [Request] Integration with Windows Hello.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cppcryptfs.