Visit Our UNIX and Linux User Community


Permission to the script.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Permission to the script.
# 8  
Old 08-12-2013
Quote:
Originally Posted by MadeInGermany
Typical permissions are
700 read/execute/write permission for the file's owner, ls -l shows rwx------
750 ... plus read/execute for the file's group, ls -l shows rwxr-x---
755 ... plus read/execute for others, ls -l shows rwxr-xr-x

@Ravinder: 711 does not make sense for a script.
Hi Geman Boy,

It is the first time i will be deploying a script in production so need yor help.
I have to mention the steps in Deployment Document
the script would be scheduled in the crontab.
The admin will log in to the unix environment give necessary permission and schedule it in crontab.
My script creates 3 temporary files and remove them at them end.
Can you suggest me the best permission mode for this?
# 9  
Old 08-12-2013
Normally you create files with the default permissions.
This is also true for temporary files.
You can ensure a certain default permissions by setting the umask before (e.g. at the top of the script)
Code:
umask 022

typical umask are
077 create files with 600 (and directories with 700), restricted for group and others
066 create files with 600 (and directories with 711), only directories access-able but not browse-able for group and others
026 create files with 640 (and directories with 750), readable for file's group
022 create files with 644 (and directories with 755), readable for others
NB1: the umask bits are complementary to the file permission bits.
NB2: files are always created non-executable. This is why on newly created scripts you have to set the x-bit(s) manually.
# 10  
Old 08-12-2013
Quote:
Originally Posted by MadeInGermany
Normally you create files with the default permissions.
This is also true for temporary files.
You can ensure a certain default permissions by setting the umask before (e.g. at the top of the script)
Code:
umask 022

typical umask are
077 create files with 600 (and directories with 700), restricted for group and others
066 create files with 600 (and directories with 711), only directories access-able but not browse-able for group and others
026 create files with 640 (and directories with 750), readable for file's group
022 create files with 644 (and directories with 755), readable for others
NB1: the umask bits are complementary to the file permission bits.
NB2: files are always created non-executable. This is why on newly created scripts you have to set the x-bit(s) manually.
Ok Thanks.

Previous Thread | Next Thread
Test Your Knowledge in Computers #259
Difficulty: Easy
Steve Jobs was born in San Francisco, California, and put up for adoption.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute permission for shell script

Hi All, I am not able to figure out what is the problem with calling a shell script within a shell script. i have given all the permissions to both schell scripts. but when i am seeing the log file error is coming like weekly_us_push_rpts_tst.sh: ./vacation_quota_summary_detail.sh: Execute... (9 Replies)
Discussion started by: krupasindhu18
9 Replies

2. Shell Programming and Scripting

shell script and Permission denied

Have the following in a .sh file. printf "Installing ... \ r" cd $ ORG_DIR / a_a . / configure> error.log Make 1> error.log 2> error.log make install> error.log But when I run I get the following. install.sh: line 270:. / configure: Permission denied make: *** No rule two make target... (3 Replies)
Discussion started by: Mumie
3 Replies

3. Shell Programming and Scripting

looking for help on script to capture file permission.

Hi Guys, I'm a DBA and need help on shell scripting. My Oracle Database is sitting on HP-UX machine. Anyone has a script that can spool out permission of all oracle binary files in the below directory: /opt/ora10g/oracle/ Format to be spooled out : chmod <exisiting permission> filename... (10 Replies)
Discussion started by: ciaciachew
10 Replies

4. Shell Programming and Scripting

permission script

hi guys I am working on a menu... and the menu has some options like check status for services (gmonitor group) or stop - start - restart those same services (gadmin group) as you see there are 2 main groups gmonitor for monitoring and gadmin for restart - stop - start services so... (2 Replies)
Discussion started by: karlochacon
2 Replies

5. Shell Programming and Scripting

simple bash script permission

I have a bash script, but it needs to have a simple protection with password. So if a user wants to run the script , there should be a kdialog to asks for a password.If the password is correct the script starts to run. It should not be the passord of root or another admin user.Just a password in... (2 Replies)
Discussion started by: poort
2 Replies

6. Solaris

Rc script permission problem

Hi, I have written a startup script which has be started while reboot. I am using Solaris10 machine and i have logged in as a root user. I have written a code the following code cp ./StartService /etc/init.d/ chmod 744 /etc/init.d/StartService //i have given it executable permissions... (3 Replies)
Discussion started by: raghu.amilineni
3 Replies

7. Shell Programming and Scripting

Rc script permission problem

Hi, I have written a startup script which has be started while reboot. I am using Solaris10 machine and i have logged in as a root user. I have written a code the following code cp ./StartService /etc/init.d/ chmod 744 /etc/init.d/StartService //i have given it executable... (0 Replies)
Discussion started by: raghu.amilineni
0 Replies

8. UNIX for Advanced & Expert Users

Script without read permission but execute the script

I have a script, except me no one can read the script but they can execute the script. Is it possible? (14 Replies)
Discussion started by: kingganesh04
14 Replies

9. UNIX for Dummies Questions & Answers

script permission error

I am writing a VERY simple script that copies my catalina log file to a new filename then copies /dev/null inotthe catalina.out. Since the log is the live log, it is open and written to as I copy. I can do the 2 copy commands from a command promp with no problem, it works. I have the probmel in... (2 Replies)
Discussion started by: rschille
2 Replies

10. Shell Programming and Scripting

file permission script

Hi all, I need one script, that will give the out put like all files having 777 permissions and full path from home directory. example:i created 777 permissions files three in my home directory and subdirectories also. i want out put like ./xxxxx/aaa.txt ./xxxxx/zzz/yyy.txt ... (3 Replies)
Discussion started by: krishna176
3 Replies

Featured Tech Videos