Help changing permissions using a shell script

Hey,
Here's the situation. We have 18 Macs, they're all cloned from a master image and have 2 local accounts - Administrator and Student.
There are some files on the machines that the student account does not have permission to access, but it's critical that they do. I've written a shell script to change the files so that everyone has permission to read, write and execute them:
#! /bin/bash
clear
sudo chmod ugo+rwx /Library/Audio/Plug-ins/Components/FM8.component
sudo chmod ugo+rwx /Library/Audio/Plug-ins/VST/FM8.vst
sudo chmod ugo+rwx /Library/Audio/Plug-ins/VST/FM8\ FX.vst
sudo chmod ugo+rwx /Library/Application\ Support/Digidesign/Plug-ins/FM8.dpm
In theory, this means I can just run the script, type the admin password in once and its done (as opposed to typing in the password 4 times and navigating to each file individually.)
However, this doesn't quite work as planned.
If I run the script, navigate to the files using the Finder and 'get info' it declares that "Everyone" can "Read & Write". The student account can see the file properly, but the finder just thinks there's nothing there (Size=Zero KB.) Only when I explicitly add the Student account (Add->Student) and set it to "Read & Write" does it start working.
2 questions really - Why does it do this, and how do I make it work?
It was my understanding that if everyone could read, write and execute there wouldn't be a problem, regardless of which account tries to access the file?
Also, if there is a better/easier/faster way of doing the same thing I'm open to suggestions.
Thanks.

Thanks Tony,
Your reply was helpful, I didn't realise you could tie all the paths together and just use one chmod command.
I actually solved the issues myself this morning (fresh head on after a good nights sleep!)
It turns out the 'files' I'm trying to modify aren't strictly files at all, they're packages. Using just chmod changes permissions for the top of the package only (hence why I could see the files but they said Zero KB.)
adding -R to the chmod modified permissions to everything inside the package as well, which has resolved the issue.
Thanks for the help though!

Similar Messages

  • Sending email attachments using unix shell script

    hi
    I want to send report generated my spooled file as attachment using unix shell script.
    Can somebody help me out ?
    many thanks

    thanks a tonn it worked.
    but i have another issue is it possible to add names in CC also ?
    Also here is my code which spools the output of SP to a txt file. the File name is generated dynamically.
    as shown below:
    I need to send this generated file as attachement.
    how do I do this? Here the shell script
    =========================================================
    #!/bin/sh
    ORA_USER=scott
    ORA_PWD=tiger
    #Get the input parameter
    if [ ! "$1" ]; then
    STR="NULL"
    else
    STR="'"$1"'"
    fi
    #echo "exec pkg1($STR);"
    #Connecting to oracle
    sqlplus -s <<EOF
    $ORA_USER/$[email protected]
    ---sql plus enviornment settings
    set linesize 160
    set pagesize 60
    set serveroutput on size 1000000 for wra
    set feedback off
    set termout off
    column dcol new_value mydate noprint
    select to_char(sysdate,'YYYYMMDDHH24MISS') dcol from dual;
    spool &mydate.report.txt
    exec pkg1($STR);
    spool off
    EOF
    exit
    =========================================================
    the file name will take sysdate as name so that every time a new file will be generated.
    this file I need to send as attachment.
    null

  • Using Power shell script how to hidden SharePoint existing features.

    Hi Firends,
    Using Power shell script how to hidden SharePoint existing features.
    Please help me.
    Thanks,
    Tiru
    Tiru

    The Hidden property is set within the solution, so you would need access to the source code in order to set it.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • How to use "do shell script" when Terminal replies with a prompt?

    Hey all,
    I'm wondering how to properly use "do shell script" when Terminal replies with a question? In this example, I'm building a small tool in AppleScript that will auto-update the Android SDK via command line prompts. The problem is when I tell it to update all ("update sdk --no-ui"), I need to accept licence agreements before it continues, and the amount of licence agreements brought up is different every time.
    So, basically, I'm wondering how to handle a case where "do shell script" encounters a case where Terminal would normally need a user's response to?
    Thanks,
    Behn

    If it is variable number of prompts that is a problem.  Look around hd and figure out how many prompts there will be. Ask around android forum for a bash solution. There are some test case apps that will let you put conditionals on output from running programs.
    # traditional way.  Pipe output to command.
    do script "echo 'ok' | update sdk --no-u"
    Here is the preferred way of getting administrator privileges.
    It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on.  Here is an example.
        Author: rccharles
        For testing, run in the Script Editor.
          1) Click on the Event Log tab to see the output from the log statement
          2) Click on Run
        For running shell commands see:
        http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
    on run
        -- Write a message into the event log.
        log "  --- Starting on " & ((current date) as string) & " --- "
        --  debug lines
        set unixDesktopPath to POSIX path of "/System/Library/User Template/"
        log "unixDesktopPath = " & unixDesktopPath
        set quotedUnixDesktopPath to quoted form of unixDesktopPath
        log "quoted form is " & quotedUnixDesktopPath
        try
            set fromUnix to do shell script "sudo ls -l  " & quotedUnixDesktopPath with administrator privileges
            display dialog "ls -l of " & quotedUnixDesktopPath & return & fromUnix
        on error errMsg
            log "ls -l error..." & errMsg
        end try
    end run

  • Please help with executing the c-shell script by using the exe class

    I try to use the exec class to execute a c-shell script in my java gui program like this. But I don't get anything when clicking on the start button.
    here is my code:
    Runtime r = Runtime.getRuntime();
    r.exec("./DDMReportEvents");
    ./DDMReportEvents is the name of the c-shell script.

    I think Runtime.exec runs DOS batch files, but not Unix shell scripts.
    Try:
    r.exec("csh -c ./DDMReportEvents");
    to get the shell to run the shell script.

  • Running report in concurrent manager using unix shell script to create PDF

    Hi,
    I need help urgently, we are in the process of migrating from 10.7 to 11i. My problem is we have a report created in 10.7 that is ran through concurrent manager using shell scripts(host) and the output is stored as .pdf, in 10.7, it works perfectly. Now I am also doing it in 11i but it gives some error. The shell script from 10.7 is: r25runm module=$XXX_TOP/srw/test.rdf \
    userid=$1 batch=yes \
    desformat=pdf destype=file \
    desname=$XXX_TOP/outbound/test.pdf
    I change the shell script in 11i as follows:
    ar60runb report=$XXX_TOP/reports/US/test.rdf \
    userid=$1 batch=yes \
    desformat=pdf destype=file \
    desname=$XXX_TOP/outbound/test.pdf
    I checked your metalink, and I am confused which is the right executable I should use, is it ar60runb or ar60run or rwrun60b or rwrun60c or rwrun60b, which is which? how many parameters do I have to include?, some documents are saying I have to use the 4 parameters-orauser/pwd, userid,username, request_id, others one.Which parameter/s go/es with what executable. We are using HP-UX server 64 bit. In 11i, when I run in concurrent manager it gives me an error:The executable file /chdev/fd11/u00/fd11appl/xxx/1.0/bin/test for this concurrent program cannot be executed.
    Contact your system administrator or support representative. Verify that the execution path to the executable file is co.
    I have checked Metalink and follow the directions, created a link fndcpesr, check and set the permissions, etc. Play around with the executables ar60runb or rwrun60 etc., the parameters. The ar60* or rwrun60* executable permissions are -rwxr-xr-x and $XXX_TOP/fnd/../fndcpesr is -rwxr-xr-x. Also, why is ar60* executables located in $FND_TOP/bin, whereas rwrun60* executables are in $ORACLE_HOME/bin? Please help, I need an answer urgently ,I have to complete this task before Tuesday 9/16/2003 for our migration deadline. Thank you very much.

    I have already fixed the problem, TY anyway

  • How to get site permissions using power shell ?

    Hello,
    I require to get list of granted permissions ( Group/users ) which we see from Site Actions > Site Permissions.
    would you please let me know how can I fetch the same using power shell ?
    Thanks and Regards,
    Dipti Chhatrapati

    Hello,
    I have found the same using following script :
    if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) { 
    Add-PSSnapin "Microsoft.SharePoint.PowerShell" 
    #Define variables 
    $site = Get-SPSite "Site collection URL"
    #Get all subsites for site collection 
    $web = $site.AllWebs
    #Loop through each subsite and write permissions
    foreach ($web in $web) 
    if (($web.permissions -ne $null) -and ($web.hasuniqueroleassignments -eq "True")) 
    Write-Output "****************************************" 
    Write-Output "Displaying site permissions for: $web" 
    $web.permissions | fl member, basepermissions 
    elseif ($web.hasuniqueroleassignments -ne "True") 
    Write-Output "****************************************" 
    Write-Output "Displaying site permissions for: $web" 
    "$web inherits permissions from $site" 
    Write-Host "Finished." 
    $site.dispose() 
    $web.dispose()
    Hope it helps others !
    Thanks and Regards,
    Dipti
    Dipti Chhatrapati

  • Find & replace part of a string in Numbers using do shell script in AppleScript

    Hello,
    I would like to set a search-pattern with a wildcard in Applescript to find - for example - the pattern 'Table 1::$*$4' for use in a 'Search & Replace script'
    The dollar signs '$' seem to be a bit of problem (refers to fixed values in Numbers & to variables in Shell ...)
    Could anyone hand me a solution to this problem?
    The end-goal - for now - would be to change the reference to a row-number in a lot of cells (number '4' in the pattern above should finally be replaced by 5, 6, 7, ...)
    Thx.

    Hi,
    Here's how to do that:
    try
        tell application "Numbers" to tell front document to tell active sheet
            tell (first table whose selection range's class is range)
                set sr to selection range
                set f to text returned of (display dialog "Find this in selected cells in Numbers " default answer "" with title "Find-Replace Step 1" buttons {"Cancel", "Next"})
                if f = "" then return
                set r to text returned of (display dialog "Replace '" & f & "' with " default answer f with title "Find-Replace Step 2")
                set {f, r} to my escapeForSED(f, r) -- escape some chars, create back reference for sed
                set tc to count cells of sr
                tell sr to repeat with i from 1 to tc
                    tell (cell i) to try
                        set oVal to formula
                        if oVal is not missing value then set value to (my find_replace(oVal, f, r))
                    end try
                end repeat
            end tell
        end tell
    on error number n
        if n = -128 then return
        display dialog "Did you select cells?" buttons {"cancel"} with title "Oops!"
    end try
    on find_replace(t, f, r)
        do shell script "/usr/bin/sed 's~" & f & "~" & r & "~g' <<< " & (quoted form of t)
    end find_replace
    on escapeForSED(f, r)
        set tid to text item delimiters
        set text item delimiters to "*" -- the wildcard 
        set tc1 to count (text items of f)
        set tc2 to count (text items of r)
        set text item delimiters to tid
        if (tc1 - tc2) < 0 then
            display alert "The number of wildcard in the replacement string must be equal or less than the number of wildcard in the search string."
            error -128
        end if
        -- escape search string, and create back reference for each wildcard (the wildcard is a dot in sed) --> \\(.\\)
        set f to do shell script "/usr/bin/sed -e 's/[]~$.^|[]/\\\\&/g;s/\\*/\\\\(.\\\\)/g' <<<" & quoted form of f
        -- escape the replacement string, Perl replace wildcard by two backslash and an incremented integer, to get  the back reference --> \\1 \\2
        return {f, (do shell script "/usr/bin/sed -e 's/[]~$.^|[]/\\\\&/g' | /usr/bin/perl -pe '$n=1;s/\\*/\"\\\\\" . $n++/ge'<<<" & (quoted form of r))}
    end escapeForSED
    For what you want to do, you must have the wildcard in the same position in both string. --> find "Table 1::$*$3", replace "Table 1::$*$4"
    Important, you can use no wildcard in both (the search string and the replacement string) or you can use any wildcard in the search string with no wildcard in the replacement string).
    But, the number of wildcard in the replacement string must be equal or less than the number of wildcard in the search string.

  • IIS Issue:when trying to download code from AWS S3 and deploy in IIS server using Power Shell script while Windows startup Default Application pool is not started.

    Hi,
    I am trying to launch Amazon EC2 windows server 2008 R2 instance using AWS Auto Scaling feature. I have used cusmized AMI in Autoscaling Launch configuration to launch an instance.I have placed Power Shell script in AMI. 
    The responsibility of script is to download code from AWS S3 and deploy in IIS server while windows startup first time.
    When i check status, IIS is started succesfully. But default Application pool is not started.
    To resolve this issue i have written one scheduled script. It helps to start the application pool if any application pool is in stopped state.
    After this Application pool is started but i am not able to communicate with IIS server through browser.  
    Please help any one to resolve this issue.
    Thanks in advance

    Hi Vchreddy,
    For the IIS issue, we recommend you can post in IIS forum for more effective support:
    http://forums.iis.net/
    Thanks for your understanding.

  • Trouble using Run Shell Script with python in Automator

    Hi. I have a python script I want to run in Automator (update_puzzles.py). All it does is check, rearrange and update files and there is not supposed to be any input. I can get the script to run outside of Automator, in Terminal, by navigating to the right directory and typing "python update_puzzles.py"
    I must not be setting up Run Shell Script correctly. I have it set to /bin/bash and Pass Input to stdin. The command line simply reads python /pathname/update_puzzles.py (where pathname is the path to the .py file, which I got by dragging the file onto the Run Shell Script command window). There are no actions before this in my workflow and the action after is View Results.
    The log says Run Shell Script failed, and the error is "Traceback (most recent call last):"
    Any suggestions?
    Thanks so much.

    If the script is expecting to do stuff with files in the same directory as the executable, you will probably need to add a statement to change to the appropriate working directory. The shell used in the Automator *Run Shell Script* action is a generic one that does not share any of the environment variables that the Terminal uses.

  • Generate RMAN backup Script using unix shell script

    Hello,
    Could somebody give me a unix shell script that would generate RMAN script based on some user defined parameters in a config file.
    e.g.
    rman.conf
    CHANNELS=4
    USE_CATALOG=Y
    DEVICE='sbt_tabe'
    etc.,
    many thanks,
    kam

    You can actually encapsulate the RMAN commands inside the shell script.
    However if you really want to create a seperate RMAN script file, you can use the unix shell's "echo" command to write set variables to a file.
    Thus, for example,
    echo "rman target / catalog rman/rmanpassword@crcat" > RMAN_Script.rmn
    echo "backup database plus archivelog" >> RMAN_Script.rmn
    echo "backup archivelog all" >> RMAN_Script.rmn
    creates RMAN_Script.rmn with 3 commands.

  • Need help to find a good shell script to delete logs, tablespace check, etc

    Can you help me to find a good working shell script to run as a cron job to check tablesapce free space per thredhold and delete old trace files, .aud files, etc.
    Thanks,

    refer the links:-
    http://www.shutdownabort.com/dbaqueries/Structure_Tablespace.php
    http://gavinsoorma.com/unix-for-the-dba/
    Shell script to delete archive logs that are 10 days old.
    Re: How to delete archivelogs ???????
    http://kmit4u.blogspot.com/2010/10/shell-script-backup-oracle-database-by.html

  • From Where i can help or manual about writing shell script in oracle

    can any one help me to write shell script in oracle.

    not sure what you meant by shell script in oracle. If ou want to write a shellscript that interacts with an oracle database, you ma want to refer to an unix programming book and sqlplus manual.
    Rgds
    Arvind Balaraman

  • What to use in shell script for CR when \n doesn't work.

    Hi I'm new to LINUX and I'm writing a shell script.
    I noticed when I'm at the command line I can type:
    echo "one\ntwo"
    and it will produce:
    one
    two
    when I put that SAME line in a shell script I get:
    onentwo
    Why? What can I use as CR character in a UNIX shell script that will work?

    That's not a normal behavior, not in Bash. Are you using the c-shell csh/tcsh ? or perhaps you have echo defined as an environment variable that was not exported, so it only works in your current shell, but not in any subshell. If you use the c-shell you may sooner or later run into problems, since this shell is not sh or bash complient.
    To enable the interpretation of backslash escape sequences in the korn or bourne shell you can use the -e paramter. For instance
    [dude@vm210 ~]$ echo -e "one\ntwo"
    one
    two

  • [SOLVED] Change environment variables with Shell scripts

    How can I change the "BROWSER" environment variable with a shell script; so I can change it on the fly?
    Last edited by oldtimeyjunk (2012-10-31 12:57:42)

    If you just want to do it for BROWSER so that you can change your default web browser on the fly, you could set BROWSER to e.g. ~/bin/mybrowser and create a symlink to the browser you want at ~/bin/mybrowser. Then you could change the symlink at will.
    EDIT: man xdg-settings
    Last edited by cfr (2012-10-31 02:20:16)

Maybe you are looking for

  • Urgent:Difference amount in customer a/c statement and customer ledger bal

    Currently I am facing a problem whererby the same customer  having the same variable - cutoff giviing  me 2 different sets of figure. 1)Using the statement of account  - cutoff as at 31 Oct 07, gives me ending figure of  -$658,526.98 (Attached file f

  • What is this file and why can't I do anything with it?

    I found this file in All my Files today and it's bugging me a bit. It seems to be a Pixelmator file with the same creation date as the file before with, giving me the impression they're linked somehow. The mystery file, however, doesn't have a locati

  • Nokia Belle FP 1 Updated

    Hi  i 've updated my NOKIA 701  to the latest update FP1 Evey thing is OK but , now i have the following problems...  > Scroll bar Not working  > i hav only 3 options in the bar which is at bottom [only call , menu , option]  (in some screen shots in

  • Reg Design Capture

    HI, i tried to capture an existing database which is really huge. my machine had gone for a task.what are the prerequistes for capturing an existing database and what is the system configuration needed for this task? help me. Thanks in advance, Dines

  • Super 8 camera effect

    i using final cut pro 5.0.4 and im looking for a certain type of filter. i have it on my pc, with a pinnacle editor. it makes the film look like it was filmed with a super 8 video camera, like from 80s where it has the lines moving across the screen,