How to create a file with full permission in unix script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to create a file with full permission in unix script
# 1  
Old 12-01-2009
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 file with full permission(_rwxrwxrwx). Not by chmod.

Code
Code:
dt=`date +%m_%d_%y`
Tablename=$1

Filename=$Tablename"_"$dt.dmp
FlgFile=$Tablename.flg
 
echo $Filename > $FlgFile
chmod 777 $FlgFile

Error
When other user executing this script they are getting an error chmod: changing permissions of .FlgFile. "Operation not permitted"

Thanks in advance
sbmk

Last edited by pludi; 12-01-2009 at 05:36 PM.. Reason: code tags, please...
# 2  
Old 12-01-2009
You can set umask 000 for the dir where the file will be created.
# 3  
Old 12-01-2009
If your colleagues and you are in same unix group, umask 002 is enough.
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. Shell Programming and Scripting

Create a UNIX script file with multiple commands

Hi Good morning all, I want to create script file with multiple commands. For ex: pmrep connect is one of the command to connect to repository. pmrep objectexport is another command to export objects to a file. These commands should run sequentially.But when i try to execute this, the first... (4 Replies)
Discussion started by: SekhaReddy
4 Replies

4. Shell Programming and Scripting

Trying to create a script to run as root, permission denied

Hello all, I am trying to create a script or a .command file that will run for me and my other techs on many, many Mac OSX computers that will add a file to the /etc/ folder called /etc/launchd.conf Every time I try to run the script, I get "Permission Denied" when trying to put the file into... (13 Replies)
Discussion started by: DonnieNarco
13 Replies

5. UNIX for Dummies Questions & Answers

TWO QUESTIONS...How to create your own command in UNIX server,How to enter data in a file by script

I am a quite newbie on UNIX SCRIPTING...Please help me solving this two questions... 1st Question; I want to create one command that will run a script when anyone use that command on that server... I mean, in the prompt if I put my name 'Rony' it will execute a script called 'rony.sh'. How can... (1 Reply)
Discussion started by: Rony-123
1 Replies

6. UNIX for Dummies Questions & Answers

Read a flat file, evaluate and create output. UNIX SCRIPT.

Hi all, I have a flat file as below; 470423495|1||TSA-A000073800||1|||1 471423495|1||TSA-A000073800||5|||5 472423495|1||TSA-A000073800||2|||7 473423495|1||TSA-A000073800||3|||3 I like to create a Unix script. The script have to valuate the last two columns, if the values are... (4 Replies)
Discussion started by: mrreds
4 Replies

7. UNIX for Dummies Questions & Answers

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... (10 Replies)
Discussion started by: sanoop
10 Replies

8. Shell Programming and Scripting

How to create xls file using unix script

Hi All, I want to create an xls file using shell script. I mean that I have written one script. It is having sql output. So I want to save that sql output into one xls file and I want to send that file as a attachment to my team MAIL_IDs. Can You any guy help me in this? Thanks in... (3 Replies)
Discussion started by: raghu.iv85
3 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