Yourself , your program will be insecure if the shared directory is implemented using these old nfs versions . there s actually a complicated workaround for old versions of nfs involving the use of 如果您自己使用了o _ excl ,而且共享目录是使用这些旧版nfs实现的,那么您的程序将是不安全的。
We ve looked at how to handle the file system and , in particular , how to handle shared directories to accomplish common tasks , such as creating temporary files in the tmp directory 还研究了如何处理文件系统,并重点讨论了如何处理共享目录,以完成在/ tmp目录下创建临时文件等一些常见任务。
If you have some bandwidth to spare , you may wish to get the package via one of the ftp or http mirrors ( see below ) and add it to your " p2p " shared directory 如果您有足够的带宽备用,您可能愿意从ftp或者http镜像(看下面所列)下载软件包,并把这些包加入您的“ p2p ”共享路径里来提供给其他人下载。
Because these shared directories have multiple uses , it s hard for the operating system to enforce access control rules to prevent attacks . instead , you actually have to use them correctly to avoid attack 由于这些标准目录有多种用途,使得操作系统难以加强访问控制来防止攻击;因此,您必须正确地使用它们,以避免受到攻击。
A common attack is to create and uncreate symbolic links in the shared directory to some other file while your program is running - files like etc passwd or dev zero are common destinations 常见的一种攻击是,当您的程序正在运行时,在共享目录中创建和反创建指向其他一些文件的符号链接/ etc / passwd或者/ dev / zero是常见的目标。
The general problem when creating files in these shared directories is that you must guarantee that the file name you plan to use doesn t already exist at the time of creation , and atomically create the file 在这些共享目录中创建文件时,常遇见的一个问题是,您必须确保您计划使用的文件名在创建时并不存在,然后自动创建该文件。
This article shows you how to handle common race conditions on unix - like systems , including how to create lock files correctly , alternatives to lock files , how to handle the file system , and how to handle shared directories - and , in particular , how to correctly create temporary files in the tmp directory 本文向您展示了如何在类unix ( unix - like )系统中处理常见的竞争条件,包括如何正确地创建锁文件、锁文件的替代者,如何处理文件系统,以及如何处理共享目录(特别是如何在/ tmp目录下正确创建临时目录) 。