として、私は数日間のgpgの問題に苦しんでいますし、私自身のことでソリューションを把握カント/コンテンツのないファイルを復号化します。私はPHPでのgpgファイルを復号化する必要がGPGは、空のファイル
:あなたは次の問題で私を助けることができる場合、私は喜んでいるだろう。そのために、私は次のコマンドを使用しています:
cat passphrase.txt | /usr/local/bin/gpg --decrypt --passphrase-fd 0 stammdaten.txt.gpg>stammdaten.txt
the passphrase.txt contains the password for decryption
stammdaten.txt.gpg is the encrypted file
the decrypted data will be written in stammdaten.txt
when i run this command in php:
shell_exec=("cat passphrase.txt | /usr/local/bin/gpg --decrypt --passphrase-fd 0 stammdaten.txt.gpg>stammdaten.txt")
i get a zero-byte output file (stammdaten.txt) with owner=ftpadmin and group=psacln
but when i execute the same command via ssh terminal (as root), the data will be decrypted and written correctly with file owner=root and group=root.
私はこれが許可の問題だと思います。どのように私は正しくPHPでそのコマンドを使用することができますか?私もchownとchgrpをftprightsonで解読しようとしましたが、何も助けにならないようです。
すべての答えが高く評価されています。ありがとう!
私はあなたの提案のコマンドをしようとした場合、私はGPG取得:無効なオプション「--passphrase-fd0と」と私は「SU ftpadmin」何も起こらないようにしようと、私はまだ、rootでログインしています。しかし、私は "suのwww - データ"私は切り替えて、私の最初のコマンドを実行します。ファイル所有者とグループが「www-data」である場合、ファイルは正常に書き込まれます。私のコマンドをwww-データとして実行することは可能ですか? – user963942
無効なオプションの問題は私のせいでした...コマンドはシェルでは動作しますが、PHPではshell_execでは動作しません。 – user963942