chmod - "future" changes


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers chmod - "future" changes
# 1  
Old 06-15-2006
chmod - "future" changes (Solved)

Edit: Solved, thanks ranj@chn!


Okay, i use the command: chmod -R ugo+rwx thefolderIwanttochange

Thats fine, but when I create new files or folders within "thefolderIwantochange" they are created with their own permissions (I assume this is normal Unix behaviour) rather than the permissions I set on "thefolderIwanttochange" and any of its subfolders (using the -R)

So I was wondering, is there any way to make it so that when new files or directories are created in "thefolderIwanttochange" or any of its subfolders, that it will automatically have the same permission settings?

Thanks,
Graeme

Last edited by gmclean2006; 06-15-2006 at 12:30 PM..
# 2  
Old 06-15-2006
read this

Read this link . It should answer your doubts.
# 3  
Old 06-15-2006
Quote:
Originally Posted by ranj@chn
Read this link . It should answer your doubts.
thanks, thats a good article, but it didn't really answer my question
# 4  
Old 06-15-2006
umask

You control global permission setting using umask. What umask does is - it applies a mask to the global permissions. Normally when files are created, the default permissions set are
Quote:
666 for files
777 for directories
This will be applicable if umask is set to 0(zero). If set a mask value of 022 like
Code:
umask 022

then, the permissions generated are
Quote:
for files -> 666 - 022 = 644 (i.e) rw-r--r--
for dirs -> 777 - 022 = 755 (i.e) rwxr-xr-x
you can see the current umask setting by just giving
Quote:
umask
So, if you want to generate files with a definite set of permissions, you set the umask value accordingly in your .profile file. Ofcourse, you cant set 777 to a file by default as every file need not be executable.
# 5  
Old 06-15-2006
oh ok i didnt get what that meant (sorry I have like no knowledge of Unix). I'll try that, thanks
# 6  
Old 06-15-2006
Edit: Okay I posted too soon

Last edited by gmclean2006; 06-15-2006 at 12:20 PM..
# 7  
Old 06-15-2006
have to use chmod

You have to use chmod. There is no other way. The permissions are like that because no one would like their files to be executable by default. Just create a wrapper to give 777 permissions like

Code:
#!/bin/ksh
chmod ugo+rwx $*

Put this into a file called
Quote:
cx
and give the file executable permissions. Then use this to create files with the permissions required.

Code:
cx file1 file_pattn*  [Not tested yet]

 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies

2. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. UNIX for Dummies Questions & Answers

Cannot "chmod" after account migration on openBSD.

I copy home directory, file /etc/passwd, file /etc/group, file /etc/master.passwd to the new server. This is result of "ls/home" on the old server. drwxr-xr-x 3 user1 user1 512 Aug 3 2012 user1 drwxr-xr-x 19 user2 user2 2560 Jan 9 09:24... (4 Replies)
Discussion started by: cyberking
4 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

Chmod. "./" and "sh" difference

Hi. I am new to shell scripting. I am writing a simple sequential logic script. After completing the script, the instructions say "use the sh command instead of the chmod comand". Why didn't I have to use "chmod ugo+x scriptname",& then type ./ scriptname or just scriptname after using chmod?... (3 Replies)
Discussion started by: Ccccc
3 Replies

7. Shell Programming and Scripting

Using mailx to send in the future? Also change "from" address?

Hey, I've got a script using mailx to send an email to the user, but i'd like it if I could have it send the email sometime in the future, not right away. And by future, i mean like 1 minute in the future. And I don't want it to halt the script in anyway. Perhaps there's a way to have it... (3 Replies)
Discussion started by: paqman
3 Replies

8. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

9. UNIX for Dummies Questions & Answers

chmod 777 on all directories below...how do I do that using the "find" command?

I've got 100 directories that each have 2 directories with in them. Structered like this: /home/domains/domain1/ through to /home/domains/domain100/ and those 2 directories mentioned above are here: /home/domains/domain1/directory1/ /home/domains/domain1/directory2/ through to... (7 Replies)
Discussion started by: Neko
7 Replies
Login or Register to Ask a Question