Linux 如何发送包含可执行文件的压缩档案,以便 Google 的附件过滤器不会拒绝它

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10757566/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 06:30:44  来源:igfitidea点击:

How to send a compressed archive that contains executables so that Google's attachment filter won't reject it

linuxcompressiontar

提问by slackmart

I have a directory that I want to compress to send it by e-mail, I've tried this:

我有一个目录,我想压缩它以通过电子邮件发送,我试过这个:

tar -cvf filename.tar.gz directory_to_compress/

But when I try to send it by e-mail, Google says:

但是当我尝试通过电子邮件发送时,谷歌说:

filename.tar.gz contains an executable file. For security reasons, Gmail does not allow you to send this type of file.

How to compress a directory into a tar.gzfile from command line?

如何tar.gz从命令行将目录压缩为文件?

采纳答案by Levon

tar -cvzf filename.tar.gz directory_to_compress/

Most tarcommands have a zoption to create a gziped version.

大多数tar命令都有z创建gziped 版本的选项。

Though seems to me the question is how to circumvent Google. I'm not sure if renaming your output file would fool Google, but you could try. I.e.,

虽然在我看来问题是如何绕过谷歌。我不确定重命名您的输出文件是否会欺骗 Google,但您可以尝试。IE,

tar -cvzf filename.bla directory_to_compress/

and then send the filename.bla- contents will would be a zipped tar, so at the other end it could be retrieved as usual.

然后发送filename.bla- 内容将是一个压缩的 tar,所以在另一端它可以像往常一样检索。

回答by divaka

Try this:

尝试这个:

tar -czf my.tar.gz dir/

But are you sure you are not compressing some .exe file or something? Maybe the problem is not with te compression, but with the files you are compressing?

但是你确定你没有压缩一些 .exe 文件之类的吗?也许问题不在于压缩,而在于您正在压缩的文件?

回答by Adriano Varoli Piazza

To bypass google's check, which is what you really want, simply remove the extensions from the file when you send it, and add them back after you download it. For example:

要绕过 google 的检查,这是您真正想要的,只需在发送文件时从文件中删除扩展名,然后在下载后重新添加。例如:

  • tar czvf file.tar.gz directory
  • mv file.tar.gz filetargz
  • [send filetargz via gmail]
  • [download filetargz]
  • [rename filetargz to file.tar.gz and open]
  • tar czvf 文件.tar.gz 目录
  • mv file.tar.gz filetargz
  • [通过 gmail 发送 filetargz]
  • [下载文件targz]
  • [将 filetargz 重命名为 file.tar.gz 并打开]

回答by user3061607

Another easy way to circumvent google's check is to use another compression algorithm with tar, like bz2:

另一种规避谷歌检查的简单方法是使用另一种压缩算法和 tar,如 bz2:

tar -cvjf my.tar.bz2 dir/

Note that 'j' (for bz2 compression) is used above instead of 'z' (gzip compression).

请注意,上面使用了 'j'(用于 bz2 压缩)而不是 'z'(gzip 压缩)。