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.
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I want to set umask so no one else can read my files. I have `umask 077` in .bashrc, .bash_profile, and .profile. I use gnome2 and gdm in Debian testing. When I create files under gnome-terminal, the permissions are set properly. But when I save files from somewhere else, say GIMP, group and other have read permission again. I suspect that I should put `umask 077` in init script for gdm, but I don't know what it is. .xinitrc and .xsession doesn't seem to work.
And also, is it possible to set umask for an individual directory? I want my public_html to have umask 022 so others can access my files and I don't have to chmod everytime I create a file.
No, it's not possible to assign individual umasks to
a directory ...
You could try setting umask=077 in
/etc/profile
which would mean that new programs you install
as root may have wrong access rights (I don't know
debian well enough to be sure of how apt handles
permissions - it certainly would be a problem if
you installed from source)
Read through the man page for the mount command. You can have a umask option for a mounted partition. This is close to what you are asking about. Rather than a directory, you can create a seperate partition dedicated for certain types of files with particular group permissions and umask setting.
Another thing to consider, is changing the group ownership of a directory and only allowing execution permission for the group. Then a user who is not a member of the group will not be able to enter the directory.
I use Mandrake Linux. There is a cron scheduled program that checks the permission of files in directories. You may have a similar program running on your system which may be changing the permissions on your saved files. Something to check. If you have a similar program running on your system, you can set it up so the permissions of files in a particular directory are adjusted to your liking.
I think I tried to put `umask 77` in /etc/profile, but it didn't work. I'll try it again.
What I want is drwx--x--x for my home directory. And rw------- for all files, and rwx------ for all directories in it. I want execute permissions for my home directory because I tried to unset it and my public_html becomes inaccessible.
And yes, my /home is on a separate partition.
Thanks for the help. I am going to try the methods you suggested.
I read the man page of mount. I couldn't find a umask option for ext2 file system. It exists for fat, hpfs, ntfs and udf. How should I set the umask for an ext2 partition?
Originally posted by super-momo
What I want is drwx--x--x for my home directory. And rw------- for all files, and rwx------ for all directories in it. I want execute permissions for my home directory because I tried to unset it and my public_html becomes inaccessible.
As for the x bits, just make the owning group something
that only apache is member of ... you don't need x for other
then.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.