Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-21-2012
Registered User
 
Join Date: Feb 2012
Location: Bangalore
Posts: 24
Thanks: 4
Thanked 0 Times in 0 Posts
How to create a file with 777 permission.?

Hi Guys,

I want to know is there any method to create a file having 777 permission. I am aware of umask, since it is only giving max. 666 permission for files this is not fulfilling my needs.

Thanks in advance

---------- Post updated at 12:49 AM ---------- Previous update was at 12:31 AM ----------

Quote:
Originally Posted by sanoop View Post
Hi Guys,

I want to know is there any method to create a file having 777 permission. I am aware of umask, since it is only giving max. 666 permission for files this is not fulfilling my needs.

Thanks in advance
Sponsored Links
    #2  
Old 02-21-2012
rangarasan's Avatar
Registered User
 
Join Date: Jul 2011
Location: Chennai, India
Posts: 484
Thanks: 9
Thanked 119 Times in 115 Posts
umask

Hi,

Before going to touch the file, use the umask command.


Code:
umask 777
touch filename

Cheers,
Ranga
Sponsored Links
    #3  
Old 02-21-2012
Registered User
 
Join Date: Feb 2012
Location: Bangalore
Posts: 24
Thanks: 4
Thanked 0 Times in 0 Posts
Thank you for the reply. But I think the maximum value that we can give for umask is 000.? So that it will create create maximum permission for files and folders.? files (666-000) & folders (777-000). I tried by giving umask 777, it is not even giving any permission also.
    #4  
Old 02-21-2012
rangarasan's Avatar
Registered User
 
Join Date: Jul 2011
Location: Chennai, India
Posts: 484
Thanks: 9
Thanked 119 Times in 115 Posts
umask

which operating system you are currently working on?
It's working fine in my unix system.

Cheers,
Ranga
Sponsored Links
    #5  
Old 02-21-2012
balajesuri's Avatar
#! /bin/bash
 
Join Date: Apr 2009
Location: India
Posts: 1,570
Thanks: 14
Thanked 441 Times in 426 Posts
@rangarasan: umask doesn't work that way. It masks permissions defined in its parameter and not provides permissions.

So, when you say umask 022 , you're masking write permission for group and others.

@sanoop: When you say umask 777 , you're masking all permissions. So no permission will be provided to file.

A work-around would be to create a file and then provide necessary permissions: touch filename; chmod 777 filename
The Following User Says Thank You to balajesuri For This Useful Post:
rangarasan (02-21-2012)
Sponsored Links
    #6  
Old 02-21-2012
rangarasan's Avatar
Registered User
 
Join Date: Jul 2011
Location: Chennai, India
Posts: 484
Thanks: 9
Thanked 119 Times in 115 Posts
umask

Thanks mate
Sponsored Links
    #7  
Old 02-21-2012
Registered User
 
Join Date: Feb 2012
Location: Bangalore
Posts: 24
Thanks: 4
Thanked 0 Times in 0 Posts
@rangarasan - I have sun operating system
@balajesuri - Yes you are correct, I am getting zero permission for the file.

---------- Post updated at 01:34 AM ---------- Previous update was at 01:30 AM ----------

@balajesuri - Yeah, but I want to avoid the scenario where changing permission after creating a file using chmod.
Do you guys believe there is no other method to achieve the same.?
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
mkdir: cannot create directory `/builds/somedir/': Permission denied Technext UNIX for Dummies Questions & Answers 5 06-01-2011 03:12 PM
How to create a file with full permission in unix script sbmk_design Shell Programming and Scripting 2 12-01-2009 02:33 PM
How to create file in ksh scripting with permission(rw-rw-rw) mansa Shell Programming and Scripting 1 11-16-2008 06:39 AM
permission on file sourav_ray UNIX for Dummies Questions & Answers 1 10-17-2008 09:20 AM
file permission/acl: 2 users with write access on 1 file... elzalem Security 0 08-28-2008 05:25 AM



All times are GMT -4. The time now is 01:07 PM.