How to create Unix Domain Socket with a specific permissions in C?

Another solution is to create a directory with the desired permissions, and then create the socket inside it (example code without any regard for error checking and buffer overflows): // Create a directory with the proper permissions mkdir(path, 0700); // Append the name of the socket strcat(path, “/socket_name”); // Create the socket normally sockaddr_un address; … Read more

How to set system wide umask?

Both Debian and Ubuntu ship with pam_umask. This allows you to configure umask in /etc/login.defs and have them apply system-wide, regardless of how a user logs in. To enable it, you may need to add a line to /etc/pam.d/common-session reading session optional pam_umask.so or it may already be enabled. Then edit /etc/login.defs and change the … Read more

Setting default permissions for newly created files and sub-directories under a directory in Linux?

To get the right ownership, you can set the group setuid bit on the directory with chmod g+rwxs dirname This will ensure that files created in the directory are owned by the group. You should then make sure everyone runs with umask 002 or 007 or something of that nature—this is why Debian and many … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)