Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
i know this sounds dreadful and scary, but i need to do it.
i need in the debian system i am on to tweak smth somewhere in a config file
that will enable an application that i am writing in c++ and which saves to files in the system, to do so in a manner that everyone is able to RW in those files.
im saving this files in a folder under /var/log/...
i have already changed /etc/profile to have value: umask 000.
but it didnt work. whenever i get a konsole window and i type umask it returns 0022 to me..
oneandoneis2, of course what you say is the most proper solution. but the problem is i'm using ofstream and it doesn't seem to be giving me the option to create the file with (0777). as for calling system("chmod 777 "+filename) that is not an option since my application is doing some sampling and system() call would slow it down.
jim_fields, i thought umask is 777- mask ..
so umask =022 means group & other non writeable (= mask = 755)
what do you mean with the
If you want a umask of 000 you would use 666 as the value to umask.
that umask should be 666 if i want a ?umask? of 000?
The umask setting of 000 is fine to make new files rwx for all. I don't recommend putting it in /etc/profile or some other system-wide settings file, as this will affect many applications, create many security issues, etc.
Rather, put it in a specific user's settings file (ie /home/user/.bashrc or /home/user/.bash_profile) or, even better, create a little script (wrapper) that sets the umask value and then calls your executable. Your executable then uses the proper umask and doesn't need to bother with chmod calls.
and initaially that was exactly what i had done..
i put umask 000 in a script and then run the executable....
yet when these files are being saved they are -rw-r--r-- root root ....!
could there be smth else?
If your program indeed does run as "root", you should be double careful with the umask.
Why not start off by telling us a bit more about your program, how it is run (ie if run as root, for what reason?),...
Also, in your script, you should have something like:
if (( $? != 0 )); then
echo "changing umask setting failed."
#verify that umask was changed, by printing the current umask setting
Is the setGID bit set for the directory where the new file is created?