Sponsored Content
Full Discussion: chmod not working as desired
Top Forums UNIX for Dummies Questions & Answers chmod not working as desired Post 302169480 by jim mcnamara on Thursday 21st of February 2008 12:23:28 PM
Old 02-21-2008
umask -S

from the man page for chmod
Quote:
If the current value of umask is 020 (umask -S displays
u=rwx,g=rx,o=rwx; do not change write permission for group) and the
current permissions for file mytest are 444 (a=r), displayed by ls -l
as -r--r--r--, then the command

chmod +w mytest

sets the permissions to 646 (uo=rw,g=r), displayed by ls -l as
-rw-r--rw-.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

chmod (permissions) * not working on remote server

Hi gurus ! I am developing a FTP script which will copy all the files from one server to another server and then I need to use CHMOD 755 * to set permissions of all the files just copied to the remote server. mput * chmod 755 * CHMOD gives me an error CHMOD works fine If I specify... (3 Replies)
Discussion started by: sdlayeeq
3 Replies

2. Shell Programming and Scripting

Script not working as desired

Reborg, Sorry to bother you. I have tried the code you suggested and it's not creating new files after they satisfy the criteria. If any of the files don't satisfy the criteria it should not create the files at all. Please see my output below. (39 Replies)
Discussion started by: mhssatya
39 Replies

3. UNIX for Advanced & Expert Users

sudo chmod not working

now running mac os x 10.53 and sudo chmod comes back with : operation not permitted. sample file: -rwxr-xr-x+ 1 1000 com.apple.monitor_all_services 276592 Jun 8 2007 342345.tif i am running as root. (1 Reply)
Discussion started by: Movomito
1 Replies

4. Shell Programming and Scripting

C shell integer tests, less than and more than, not working as desired

Hello, I am creating a script that gives me system load info when i start a shell or log in via ssh(in the /etc/profile.d/ folder). I created it successfully for bash and want it to work with c-shell as well. This is where i'm having problems, the integer test in the if sentence does not work... (3 Replies)
Discussion started by: str1fe
3 Replies

5. UNIX for Dummies Questions & Answers

if statement not working as desired

Hello all, I am trying to write a post-commit hook script using bash script. What I am trying to do here is: Developers check in their files to a branch. I check the repository and based on the commit I email QA people. QA verifies and moves the files to a prod branch and email is sent... (1 Reply)
Discussion started by: kminkeller
1 Replies

6. Shell Programming and Scripting

sudo chmod not working through script

Legends, I am trying sudo chmod from one shell to different machine. but getting the error. Please let me know if there is any way to do this. A#pk} for i in Bl1 Brl1 >> do >> echo $i >> ssh $i sudo chmod 755 /etc/services >> done Bl1 Password: bash: sudo: command not found ... (2 Replies)
Discussion started by: sdosanjh
2 Replies

7. UNIX and Linux Applications

What is the difference between chmod in solaris and chmod in Linux?

i think it is the same in both... Iam i right? (1 Reply)
Discussion started by: sumaiya
1 Replies

8. Shell Programming and Scripting

need to get the desired output

Below is the my cide which is working fine but I am not getting the output indesired format.there is some problem in alignment.Can someone help me to correct this? if ]; then summary=$( echo -e "Please review the log file of auto coloclean utility.\n"; echo -e... (2 Replies)
Discussion started by: anuragpgtgerman
2 Replies

9. Shell Programming and Scripting

Cron job is not working in the desired manner on IBM AIX

Hi, I have created a cron job on IBM AIX but it is not working in desired manner ! Here are the steps which I have followed :- #!/bin/ksh #------------------------------------------------------------------ find /some/file/at/the/user/side/test.log -exec cp {}... (8 Replies)
Discussion started by: acidburn_007
8 Replies

10. Shell Programming and Scripting

Chmod working in sudo run script but chown isn't

My git user has permission in sudoers to run a wrapper script to move files into my webroot. Everything is working fine except for the chown line. After the script has run, the files ar still root:root instead of apache:apache. Scratching my head...:confused: #!/bin/sh echo echo "****... (4 Replies)
Discussion started by: dheian
4 Replies
umask(1)						      General Commands Manual							  umask(1)

NAME
umask - Displays or sets the file mode creation mask SYNOPSIS
umask [-S] [mask] Note The C shell has a built-in version of the umask command. If you are using the C shell, and want to guarantee that you are using the com- mand described here, you must specify the full path /usr/bin/umask. See the csh(1) reference page for a description of the built-in com- mand. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: umask: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Produce symbolic output. Output is produced in a format that is recognized on a subsequent invocation of umask as a mask operand to restore the previous file mode creation mask. If the -S option is not used, output is displayed as an octal integer, but is still usable as input on a subsequent invocation of the umask command. OPERANDS
A string specifying the new file mode creation mask. This string may may be an octal value or a symbolic_mode value. For a symbolic_mode value, the new value of the file mode creation mask is the logical complement of the file permission bits por- tion of the file mode specified by the symbolic_mode string. In a symbolic_mode value, the characters + and - are interpreted relative to the current file mode creation mask; + causes the bits for the indicated permissions to be cleared in the mask; - causes the bits for the indicated permissions to be set in the mask. The file mode creation mask is set to the resulting numeric value. In the obsolescent octal integer form of mode, the specified bits are set in the file mode creation mask. DESCRIPTION
The umask command sets the file mode creation mask of the current shell execution environment to the value specified by the mask oper- and. This mask affects the initial value of the file permission bits of subsequently created files. If the mask operand is not specified, the umask command writes the value of the invoking process's file mode creation mask to standard out- put. If the -S option is specified, the output is in the following format: "u=%s,g=%s,o=%s ", <owner permissions>, <group permissions>, <other permissions>" The three values are combinations of letters from the set {r, w, x}; the presence of a letter indicates that the corresponding bit is clear in the file mode creation mask. NOTES
Any mask operand such as -r, -w, -x, or anything beginning with a hyphen, must be preceded by -- to keep it from being interpreted as a option. Since umask affects the current shell execution environment, it is provided as a shell regular built-in. In contrast to the nega- tive permission logic provided by the file mode creation mask and the octal number form of the mask argument, the symbolic form of the mask operand specifies those permissions that are left alone. Although the references to octal modes are obsolescent in the ISO/IEC 9945-2:1993 standard, they are maintained for portable applications until further notice. RESTRICTIONS
If umask is called in a subshell or separate utility execution environment, it does not affect the file mode creation mask of the caller's environment. A separate execution environment could be one of the following: (umask 002) nohup umask ... find . -exec umask ... ; EXIT STATUS
The following exit values are returned: The file mode creation mask was successfully changed, or no mask operand was supplied. An error occurred. EXAMPLES
To set the file mode creation mask so that subsequently created files have their write by all others bit cleared, enter either of the fol- lowing commands: umask a=rx,ug+w umask 002 If the file mode creation mask was set with either of the above commands, the umask command can be used to write out the current value of the mask. To write the value in octal format, enter: umask This provides the output: 0002 To write the value in symbolic format, enter: umask -S This provides the output: u=rwx,g=rwx,o=rx The following sequence of commands is an example of how to save the current file mode creation mask and later restore the value using the umask command and octal integer formats. Examine the current value of the mask: umask The current mask is reported as: 022 Save the current value, and verify the saved value: SAVEMASK =`umask` echo $SAVEMASK The saved value is reported as: 022 Change the current mask: umask 444 Verify the change: umask The new mask is reported: 0444 Restore the previous mask: umask $SAVEMASK Verify the restored value: umask The value is now restored: 022 The following sequence of commands is an example of how to save the current file mode creation mask and later restore the value using the umask command and symbolic_mode formats. Examine the current value of the mask: umask -S The current mask is reported as: u=rwx,g=rx,o=rx Save the current value, and verify the saved value: SAVEMASK=`umask -S` echo $SAVE- MASK The saved value is reported as: u=rwx,g=rx,o=rx Change the current mask: umask a= Verify the change: umask -S The new mask is reported: u=,g=,o= Restore the previous mask: umask $SAVEMASK Verify the restored value: umask -S The value is now restored: u=rwx,g=rx,o=rx To set the file mode creation mask so that subsequently created files have all their write bits cleared, enter: umask -- -w ENVIRONMENT VARIABLES
The following environment variables affect the execution of umask: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the for- mat and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: chmod(1) Functions: chmod(2), umask(2) Standards: standards(5) umask(1)
All times are GMT -4. The time now is 07:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy