Sponsored Content
Top Forums Shell Programming and Scripting Setting default permissions without umask or cron jobs Post 302646009 by Karunamon on Thursday 24th of May 2012 11:32:43 AM
Old 05-24-2012
Setting default permissions without umask or cron jobs

I've got a number of people sending files to me in different directory structures, and users on many different groups who need access to these incoming paths.

My problem is that umask assumes a default of 666 for files. No execute bit, meaning that my users can't even see the incoming folders. And since umask can't *add* permisssions..

The files being delivered are not executable, and the drop paths are sufficiently isolated so I am not concerned from a security standpoint.

Currently, I've been getting around this with a ton of assorted chmod cron jobs to clean up the permissions, but this feels like a really ugly hack.

Is there a way to to get incoming SCP/SFTP files to have o+x rights as they are created, without requiring manual action by the users dropping files?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Setting Default Permissions for Files

Hi, I am setting up an area on a unix server where multiple people will be editing web pages. Can anyone tell me how to set it up the directory and subdirectories so that when a user creates a new file, it defaults to permissions of 664 or 775? I've tried using umask but from what I can... (1 Reply)
Discussion started by: robbieg
1 Replies

2. UNIX for Advanced & Expert Users

Changing default permissions -without "umask"-...

Hi! My question is this: Is it possible to change the default permissions in UNIX (666 for files and 777 for directories)?. I am not talking about using the command "umask". I mean, with the command "umask" you can modify permissions from a default permissions x. Is it possible to make... (4 Replies)
Discussion started by: chicoGuapo
4 Replies

3. Solaris

Setting environment variables within cron jobs!!

Is it possible to use environment variables within cron jobs. I am using a cron job to run a c program at regular intervals. The C program uses a library and i have set the library path in the LD_LIBRARY_PATH environment variable. But when i ran the job i got the error library not found!! Any... (1 Reply)
Discussion started by: atheek
1 Replies

4. Shell Programming and Scripting

umask setting

dear all, i'm trying to set the default permission using umask commnd. i'm using bash shell and the permission of the .bash_profile file is -rwxr-x--- 1 tdmscrdr dba 370 Nov 7 12:21 .bash_profile but still i'm not able to change the default permissiom. in the .bash_profile... (1 Reply)
Discussion started by: panknil
1 Replies

5. UNIX for Dummies Questions & Answers

Listing and setting up cron jobs

How can I list the existing cron jobs in my system, and then how can I add my script to the cron jobs list? Thanks. (3 Replies)
Discussion started by: NycUnxer
3 Replies

6. UNIX for Dummies Questions & Answers

UMASK setting

How can we set the Sticky bit in the umask itself. Please help me :confused: I tried to set like umask 1000 but when I run umask, the value of umask is 00 (0 Replies)
Discussion started by: geniman2004
0 Replies

7. AIX

default umask setting during ftp

Hi all, How do i change the default primary group of files uploaded in AIX (via ftp) in such a way that the files will be owned by tom:staff? I understand that the default file permission can be set in /etc/profile for aix by adding a new line umask=032 Do I add a line in umask as well?... (5 Replies)
Discussion started by: chipahoys
5 Replies

8. UNIX for Dummies Questions & Answers

Setting umask 022 by default to my profile

Hello everyone, I want to set my properties of my profile to umask 022 by default. I have an idea that i need to make the change in .profile file. Can you please help me, on how would i be able to set it. Thanks, Abhishek S. (4 Replies)
Discussion started by: abhisheksunkari
4 Replies

9. UNIX for Dummies Questions & Answers

Default umask setting during ftp AIX

Hi, I have set below option in following file /etc/inetd.conf in AIX. ftp stream tcp6 nowait root /usr/sbin/ftpd ftpd -u 2 But still it created the file with permission (640): -rw-r----- 1 ftptosas ftpusrg 6091 Jul 28 12:23 diff_061920.txt Required permission... (1 Reply)
Discussion started by: mageshpsv01
1 Replies

10. UNIX for Beginners Questions & Answers

Umask to generate files with rwx permissions for all

i need my script1.sh to generate /tmp/temp.txt with full permissions i.e -rwxrwxrwx 1 user1 users 23 Dec 16 10:52 /tmp/temp.txtmore script1.sh umask 666 echo "hello">/tmp/temp.txt But the script1.sh generates temp.txt with different permissions as shown below. -rwxr-xr-x 1 user1 users... (6 Replies)
Discussion started by: mohtashims
6 Replies
UMASK(3)								 1								  UMASK(3)

umask - Changes the current umask

SYNOPSIS
int umask ([int $mask]) DESCRIPTION
umask(3) sets PHP's umask to $mask & 0777 and returns the old umask. When PHP is being used as a server module, the umask is restored when each request is finished. PARAMETERS
o $mask - The new umask. RETURN VALUES
umask(3) without arguments simply returns the current umask otherwise the old umask is returned. EXAMPLES
Example #1 umask(3) example <?php $old = umask(0); chmod("/path/some_dir/some_file.txt", 0755); umask($old); // Checking if ($old != umask()) { die('An error occurred while changing back the umask'); } ?> NOTES
Note Avoid using this function in multithreaded webservers. It is better to change the file permissions with chmod(3) after creating the file. Using umask(3) can lead to unexpected behavior of concurrently running scripts and the webserver itself because they all use the same umask. PHP Documentation Group UMASK(3)
All times are GMT -4. The time now is 10:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy