开发者

Write permission for chat files

So in a chat application when someone sends a new message and it will be written into the chat log, but the files on server are set can't be written by others. Do we chang开发者_开发技巧e the permission temporarily when it's being written (777?) and then change it back?


Your server side code runs under one user account irrespectively to how many clients you have. If you try to save chat history on the server, maybe go for a database or XML. If you still want to store logs in multiple files, then don't bother with permissions, you will configure it later on IIS (again for one account only).

On the client side code is likely to run under the local user account, who should have write permissions by default.


Do we change the permission temporarily when it's being written (777?) and then change it back?

No, never do this. Even in situations where you could, it would entirely undermine the purpose of unix file permissions.

Your chat application should be running as the same user who owns the log files, or as a user in the group which owns the files. Then you just need to ensure that the files' owner (or group) has the write permission for the files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜