LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   umask (https://www.linuxquestions.org/questions/linux-newbie-8/umask-55293/)

knueven7 04-16-2003 07:56 AM

umask
 
I have no idea how to use umask. I am trying to make it so when someone (anyone) writes/creates anything in a certain directory the permissions are set to user read write group read write and everyone read. Do I have to change this per user or can I do it by individual directory and how do I do it.

cuckoopint 04-16-2003 09:43 AM

man umask

But for what you are doing, I think you need to look at chmod:

man chmod

If I understood you correctly:
chmod -R 664 /path/to/dir/

/edit
sry, I misread you're post. 'man umask' should be self explanatory, bust basically whatever you set it to, it subtracts from the permissions.

knueven7 04-16-2003 09:51 AM

I did chmod already, but the problem is with FTPing. When I create a webpage on my machine and upload via FTP it does not take on the permissions of the directory. I then have to physically go to the server and re-chmod the directory.

cuckoopint 04-16-2003 11:13 AM

If this was something as simple as a 'cp', you could just make a script that saves the original umask, changes it, copies the file, and then changes the umask back. But I don't know how to get this working over ftp (and I don't know of a way to get the directory to enforce permissions). If know one comes with some help, I guess all you're left with is to edit your behavior somewhere in the creation process - ie. lets say you use 'touch' to create the file, then make a little alias to replace it with ftouch (or something) which automatically changes the permission. This will give you some less typing, but comes no where near of solving your problem (esp. if different people upload to this server). I haven't done much with ftp, but maybe you can create a script to chmod the directory everytime something is uploaded...
; )

sry I couldn't be more helpful.

knueven7 04-16-2003 11:51 AM

umask
 
The user (ftp_user) I have using ftp is a member of the www group. I can create a file and ftp it and the owner can stay the same(ftp_user) the group is already the same as the group that owns the directory (www), but I just need to take off the everyone write,execute permission and add group write. Is there no easy way to change the default permissions a user assigns to the files they create?

whegge 04-16-2003 02:09 PM

What FTP server are you using? Most FTP servers have a way for you to do what you want built in to them, usually a configuration setting.

knueven7 04-17-2003 12:46 PM

umask
 
Okay I got the ftp figured out (you can just change the values in the config file), but what about when a user creates a file, saves it to their desktop and then moves it to a restricted shared drive. I have users that do this and are members of a group (opla) but when it gets stored on the shared drive the person that created the document is the only one that can do anything with it, other group members are denied access. I want the group to have full access to the files created by other members of their group.

cuckoopint 04-17-2003 06:05 PM

can't you just tell the users to change the group of the file to opla before uploading?

Or I guess you can write some script to chgrp the files before/after the actual upload.

I'm just not sure how to automate this. Either attach this script to execute after anytime ftp is run (not very effective), or maybe some kind of cron job...?

knueven7 04-18-2003 07:30 AM

umask
 
they don't need to change the group before they upload because they are already uploading as the correct group, but they do not upload with the group write/enter permissions, just read.


All times are GMT -5. The time now is 04:25 AM.