Need basic unix (terminal) help -- chmod and wildcards

Discussion in 'Mac OS X 10.3 (Panther) Discussion' started by cleo, Sep 3, 2004.

  1. cleo macrumors 65816

    cleo

    Joined:
    Jan 21, 2002
    Location:
    Tampa Bay Area, FL, USA
    #1
    Ok, I've got about 75 files on a server that I need to chmod, all cgi's. The easiest way to do this, I assumed, would be with a wildcard. But.

    When I type ls *.cgi all 75+ files are returned. When I type chmod 755 *.cgi I get ac "no such file or directory" error.

    What gives?
     
  2. d_p macrumors newbie

    Joined:
    Jan 6, 2004
    Location:
    DC
    #2
    Try this: /bin/chmod 755 ./*.cgi
    Also, make sure you are the owner of the files or root.
     
  3. cleo thread starter macrumors 65816

    cleo

    Joined:
    Jan 21, 2002
    Location:
    Tampa Bay Area, FL, USA
    #3
    Nada. It spits out:
    ?Invalid command

    And yeah, I'm the owner of all the files.

    More ideas?
     
  4. abhishekit macrumors 65816

    abhishekit

    Joined:
    Nov 6, 2003
    Location:
    akron , ohio
    #4
    Are they all in a single folder ? if yes, you can goto that folder and write

    chmod -R 755 *

    it would change the permissions for all files.
     
  5. tomf87 macrumors 65816

    tomf87

    Joined:
    Sep 10, 2003
    #5
    Sounds to me like your chmod program is gone or corrupt or has bad permissions.

    Do a 'which chmod' then a 'ls -l <output of earlier which command>:

    Code:
    mac:~ username$ which chmod
    /bin/chmod
    mac:~ username$ ls -l /bin/chmod
    -r-xr-xr-x  1 root  wheel  14436 30 Aug 21:35 /bin/chmod
    mac:~ username$
    
    Does yours look similar to mine? My output is from 10.3.5.
     
  6. Westside guy macrumors 601

    Westside guy

    Joined:
    Oct 15, 2003
    Location:
    The soggy side of the Pacific NW
    #6
    The files in question are on a server, not on your local machine? What OS is on the server? You can find the OS on most *nix-ish machines by typing "uname -a" from the command prompt.

    The "which" command mentioned above is a good bet to resolve this.

    I am wondering if the server in question is running your session in a "chroot jail". Often-times you'll have a very limited set of commands available to you in that situation.
     
  7. Nermal Moderator

    Nermal

    Staff Member

    Joined:
    Dec 7, 2002
    Location:
    New Zealand
    #7
    I ran into a similar problem just yesterday when I typed 'mv somefilename.conf *.bak' and ended up with a file named *.bak, which of course isn't what I expected! So it looks like some commands support wildcards, but others don't.

    BTW, what's the difference between 'which' and 'whereis'?
     
  8. Westside guy macrumors 601

    Westside guy

    Joined:
    Oct 15, 2003
    Location:
    The soggy side of the Pacific NW
    #8
    Wildcards generally need to be part of the "target" file/directory rather than the "result" (bad terminology, I know).

    "which" basically tells you "if I type command 'xxxx', what binary will be run (if any)?" "whereis", on the other hand, will show you all the versions of command 'xxxx' that exist in your path. So if you have three versions of the command 'ssh', which will return one entry, while whereis will return three entries.
     

Share This Page