How to create a file with 777 permission.?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to create a file with 777 permission.?
# 1  
Old 02-21-2012
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
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
# 2  
Old 02-21-2012
umask

Hi,

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

Code:
umask 777
touch filename

Cheers,
RangaSmilie
# 3  
Old 02-21-2012
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.Smilie
# 4  
Old 02-21-2012
umask

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

Cheers,
RangaSmilie
# 5  
Old 02-21-2012
@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
This User Gave Thanks to balajesuri For This Post:
# 6  
Old 02-21-2012
umask

Thanks mate Smilie
# 7  
Old 02-21-2012
@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.?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

JAVA code to create file in Linux with specific permission

Hi All, I'm looking for JAVA code to create file in Linux with specific permission File should be created and saved in Linux in this path \opt\sys\doc by Java with this permission 764 Anyone can help to provide this Java code (3 Replies)
Discussion started by: AbuAliiiiiiiiii
3 Replies

2. Shell Programming and Scripting

Need a script to create file permission change restriction

Hello, I am looking for a UNIX shell script which can help me for access restriction. 1) /home/ram, there are number file with .txt extension, which should be only owned "ram" user. like as below ls -lrt *.txt -rwx------ 1 ram dba 11 Jan 4 2015 PASS1.txt -rwx------ 1 ram dba 10 Jan 4... (8 Replies)
Discussion started by: mr.trilok
8 Replies

3. UNIX for Dummies Questions & Answers

FILESYSTEM not FULL, PERMISSION is 777, but cant write to the server

ANy reasons? FILESYSTEM not FULL, PERMISSION is 777, but cant write to the filesystem? any steps to do? reasons for this? (9 Replies)
Discussion started by: kenshinhimura
9 Replies

4. Shell Programming and Scripting

get file permission in 777 format

Hi All, Is there any unix(solaris) command to get file permissions in 777 format or do we need to write some script for it? (7 Replies)
Discussion started by: rishav
7 Replies

5. Shell Programming and Scripting

set permission on file to 777

Here is the sample code I'm trying to execute. I see that the permission on the file is set to 755 always I want to change it to 777. Please help me with this. code : #!/usr/bin/perl use File::Path qw(make_path remove_tree); my $path = "2010/sam"; make_path($path,{mode=>0777}); ... (1 Reply)
Discussion started by: hansini
1 Replies

6. Shell Programming and Scripting

How to create a file with full permission in unix script

In my script, I am creating a file ----> then writting one line (i.e. Timestamp) ----> then FTP'ing. The same script can be executed by many other users. While other users executing this script, they couldn't Over write this one line (i.e. Timestamp) My expectation So I wanted to create a... (2 Replies)
Discussion started by: sbmk_design
2 Replies

7. Solaris

/usr/bin has been changed with 777 permission

Hello Guruz, Relay bad condition :mad: Some has changed the permission to 777 recursively for /usr/bin directory by mistake. Now all the permission looks to be 777 on /usr/bin Hence I am so many system related errors as 1 show below. When I am trying to change the password, I am getting... (5 Replies)
Discussion started by: bullz26
5 Replies

8. Cybersecurity

can another user 777 and existing 777 dirctory?

User usrA creates dirA directory and runs chmod 777 on the directory. Can usrB issue another 777 on dirA? It appears the answer is no even if the usrA and usrB are part of the same group. I know this is a rare scenario but I just ran across it and found out that usrB receives an error when... (4 Replies)
Discussion started by: zlek131
4 Replies

9. Shell Programming and Scripting

How to create file in ksh scripting with permission(rw-rw-rw)

Hi, Please provide your inputs.. Thanks in Advance, Mansa (1 Reply)
Discussion started by: mansa
1 Replies
Login or Register to Ask a Question