我正在为一个gpg问题挣扎几天,无法找到我自己的解决方案。我会很高兴,如果你可以帮我解决以下问题:GPG解密没有内容的文件/为空文件
我需要在php中解密一个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中正确使用该命令?我也尝试用ftprightson解密文件chown和chgrp,但似乎没有任何帮助。
每个答案都非常感谢。谢谢!
如果我尝试你的建议命令,我得到gpg:无效选项“--passphrase-fd0”,如果我尝试“su ftpadmin”没有任何反应,我仍然以root身份登录。但是当我“苏www数据”我切换并执行我的初始命令。文件所有者和组则是“www-data”,文件写入成功。是否有可能执行我的命令作为万维网数据? – user963942 2012-03-19 12:31:17
无效选项问题是我的错......该命令在shell中工作,但不在shell中的shell_exec中。 – user963942 2012-03-19 13:59:39