Re: setting file permissions on a web server



> In short, chmod refers to local files so wherever you run it it will
> refer to files on that machine. You run it simply by typing it in a
> shell as a user who has privilage to perform the operatation, which
> can mean you have to be an owner of the file but if you are root you
> can do it in any case. Depending on your ftp, scp, http or whatever
> method you use to transfer files the file permissions may or may not
> change during the transfer. If permissions are kept intact you can
> chmod on your local machine and then transfer, if they are not then
> you transfer first and chmod on the server. When you transfer files
> from a windows machine to *nix it again depends on the particular
> method you choose how the permissions will be set.

Thanks, but I'm still a little confused. Since I'm running Windows, I
assume that I can't run the chmod line on my own computer.

Correct, chmod is a *nix command.

My web server
uses Unix, but is it possible for me to have access to a command line
for the server?

This depends on your arrangements with your web server provider.
Perhaps you are allowed to ssh into that machine, perhaps not, you
need to ask your provider. In case you can use ssh, then you can log
in with putty (an ssh client for windows, grab it from here:
http://www.chiark.greenend.org.uk/~sgtatham/putty/) and you will have
a command line on the server so you can run chmod there.

I didn't know that was possible for basic web hosting plans (I'm using 1and1 right now).

I have absolutely no experience with public web hosting but I guess
some might provide ssh-ing possibilities although I imagine most
don't.

I suppose I could write a script that would set the permissions of all
the files in a particular folder on my computer to 755, but is there a
Windows equivalent command for chmod to do this?

I have next to zero experience with windows but as far as I know
windows doesn't have file permissions at all (anyone, please correct
me if I'm wrong :)) so in windows land it doesn't make any sense to
"change file permissions". Even if it has some sort of a notion of
file permissions I wouldn't know how that gets translated into unix.

Or am I stuck having to do it on the server side?

I guess so. But that's not a terribly big problem even if you can't
use ssh. What I would do is write a script (in python of course :))
that does the file permission changing and run that script over the
web. Since this can have serious security implications my strategy
would be to place this script somewhere which is not reachable through
the web and only relocate it to a web accessible directory when you
want to run it over the web, and when you are done, you place it back
to its secure location so nobody can reach it. You can find out how to
write this script from http://docs.python.org/lib/os-file-dir.html

HTH :)
.



Relevant Pages

  • Re: rmdir and chmod help for Windows XP Home!
    ... chmod and rmdir are UNIX commands which have no effect in a Windows ... > in a test script and everything went OK... ...
    (comp.lang.php)
  • rmdir and chmod help for Windows XP Home!
    ... From what I read from the PHP manual, chmod on a Windows platform ... I create a directory on my Windows box, and set chmod 777 on it (that ... I can create/delete subdirectories either by hand or by script with no ... So, for PHP on windows, chmod 777 makes the file undeletable ...
    (comp.lang.php)
  • Re: 2 Newbie questions.
    ... > I have searched the net and performed chmod +x mypython.py and added as the ... Not really a Python question, but maybe I can help anyway. ... moving a script from a Windows box to a Unix box because the shell doesn't ... dos2unix or a similar script to remove these. ...
    (comp.lang.python)
  • Re: change the file permissions in a Shell Script
    ... team members try to run this script, it is getting abended as the they ... do not have sufficient privileges to overwrite this file. ... i can use chmod within the script to change the file permissions, ... also i would like to know how UNIX decided to give file permissions to ...
    (comp.unix.shell)
  • Re: setting file permissions on a web server
    ... windows doesn't have file permissions at all (anyone, ... What I would do is write a script ) ...
    (comp.lang.python)