I have written a script and now i want to deploy it in PRODUCTION.
I want to give all the permission to the user only but not to others.What permission should i use?
CHMOD 777 FILENAME?
I have written a script and now i want to deploy it in PRODUCTION.
I want to give all the permission to the user only but not to others.What permission should i use?
CHMOD 777 FILENAME?
If you want to give all permission to the user only (including read, write and execute), you could chmod 0700 the script and make sure you chown and chgrp the file (script) ownership to the user you want to give it out to.
Hello,
Please use code tags for posting commands. Please use the following command to give permissions to user for script and not to others.
But you can take a test in QA onced before putting in PR please.
-rwx--x--x 1 singh1 users 548 Aug 09 10:42 date_solution.ksh
$ chmod 711 date_solution.ksh
$ ls -ltr | grep "date_solution.ksh"
-rwx--x--x 1 singh1 users 548 Aug 09 10:42 date_solution.ksh
$
Just an example for a file is given above.
Thanks,
R. Singh
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.
Hello MadeInGermany,
I just wanted to give execute permissions to others. Please correct me if I am wrong here, I will be grateful to you.
Thanks,
R. Singh
You don't need execute permission to be able to execute a script, but you certainly can't execute it if you can't read it.
Thanks Scott and MadeInGermany for explaining me the same.
Thanks,
R. Singh
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?
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)
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.