View Full Version : Need basic unix (terminal) help -- chmod and wildcards
cleo
Sep 3, 2004, 11:35 AM
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?
Try this: /bin/chmod 755 ./*.cgi
Also, make sure you are the owner of the files or root.
cleo
Sep 3, 2004, 11:59 AM
Try this: /bin/chmod 755 ./*.cgi
Also, make sure you are the owner of the files or root.
Nada. It spits out:
?Invalid command
And yeah, I'm the owner of all the files.
More ideas?
abhishekit
Sep 3, 2004, 12:20 PM
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.
tomf87
Sep 3, 2004, 04:16 PM
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>:
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.
Westside guy
Sep 3, 2004, 10:37 PM
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.
Nermal
Sep 4, 2004, 04:01 AM
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'?
Westside guy
Sep 4, 2004, 04:37 AM
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'?
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.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.