Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
Sorry I cannot work this out I have read heaps on the umask setting but cannot get the result I want. I want a umask setting that will give me the permissions rw-rw-rw- (666). Can someone please tell me what that would be?
Umask is a subtraction of the octal permissions, which if you set your umask to 0 will be 666, by design it makes nothing executable(directories are an exception for the owner) by default.
So your default new file perms will always be 666 subtracted by your umask.
Thanks for that. The link you gave me was one I was using but I ended up with 111 and denied myself access. It a bit early in the morning but I will have to print that out and sit with pen and paper and work it out.
Just set your umask to 000 in your .bashrc file, you should be good. Keep in mind that some people consider this to have some security implications due to the write permission for the all users set.
Just set your umask to 000 in your .bashrc file, you should be good. Keep in mind that some people consider this to have some security implications due to the write permission for the all users set.
Thank you so much for getting back to me as I remain a little confused but as you mentioned the .bashrc I think I may be gaining some understanding.
Am I right to say that the .bachrc umask setting sets the default for the system? The umask I was applying was to a mounted external drive. Initially the usmask was 022 and that was given to me it set the permissions to 555. I knew the umask was important for the permissions as I had to deal with it in vsftpd.conf (changed to Pure-Ftp).
That tutorial talks about subtracting the umast value, must have some relation to the system, am I correct?
The umask of 000 has given me 777 on directories and files. That's OK it works but I guess security should not be compromise anywhere. The External drive I have connected also has a samba share and that allows reading and writing to anyone on the Windows box. That is OK.
So setting the umask on the drive the value has some relation to the umask for the system. Would you have a minute to explain that to me and why I got the permissions of 777.
if you are creating files that have 777 perms by default I would like to know how because I didn't think it was possible. The default permissions in the Linux OS are(rwxrwxrwx) 0777 for directories and for files they are 0666 (rw-rw-rw).
The .bashrc file is a user bash configuration file, the umask is a environment variable associated with your user's environment. The .bashrc file is read each time you login and each user will have one in their home directory. You can set any custom aliases, env variables etc.. in this file to be set each time you login.
The umask setting is a system wide variable, so there isnt a way to set it just for one file system or hard drive as you mention. It simply tells the OS to subtract XXXX octal permissions from new files or folders that are created.
If you set your umask to 0000 in your .bashrc any new files you create should have the perms of 0666 and directories 0777, if you see something different please provide some bash output that shows what you did, exactly how you did it, and the results.
As Kustom42 said earlier, umask subtracts from the permissions. I don't recall if the standard permissions without umask are 777 or 666, but either way, umask subtracts from those. To expand on Kustom42's examples, let's have a look with the generic equation (again I'm not sure if it was 777 or 666 for standard permissions so I'm using 777).
Code:
777
- umask
===============
New Permissions
So as another example:
Code:
umask = 123
777
- 123
=======
654
With umask = 123, permissions are set to "rw-r-x-r--".
For clarification, the defaults are 0666 for files and 0777 for files. That is what Mr. Google's says and I tested it on a Red Hat system to confirm. There may be some differences with other distros but I havent found anything to suggest there is.
Thank you everyone for your help. I went to Birmingham today to Waterstones a purchased some books on Linux and WordPress so things are coming together.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.