Changes file permissions of a file on a Globus resource.






gd_chmod(host,remotefile,mode) where host is a string describing the resource. It could be in one of the following formats:

- hostname

- hostname:port

- hostname/service

- hostname:port/service

The second argument remotefile is a string describing the full name of the file starting from root '/'. The final argument mode is a string describing the permissions of the file. The permission of a file can be either a symbolic representation of changes to make, or an octal number representing the bit pattern for the new permissions (see below).


gd_chmod(host,remotefile,mode,command) as above, except the argument command is a string specifying the absolute path of the chmod command on the Globus resource.


Input arguments

mode               The argument mode may have two alternative forms:


1. Symbolic representation:

A combination of the letters 'ugoa' controls which users' access to the file will be changed: the user who owns it (u), other users in the file's group (g), other users not in the file's group (o), or all users (a).


The operator '+' causes the permissions selected to be added to the existing permissions of each file; '-' causes them to be removed; and '=' causes them to be the only permissions that the file has.


The letters 'rwxXstugo' select the new permissions for the affected users: read (r), write (w), execute (or access for directories) (x), execute only if the file is a directory or already has execute permission for some user (X), set user or group ID on execution (s), sticky (t), the permissions granted to the user who owns the file (u), the permissions granted to other users who are members of the file's group (g), and the permissions granted to users that are in neither of the two preceding categories (o).


2. Octal number representation:

A numeric mode is from one to four octal digits (0-7), derived by adding up the bits with values 4, 2, and 1. Any omitted digits are assumed to be leading zeros.  The first digit selects the set user ID (4) and set group ID (2) and sticky (1) attributes. The second digit selects permissions for the user who owns the file: read (4), write (2), and execute (1); the third selects permissions for other users in the file's group, with the same values; and the fourth for other users not in the file's group, with the same values.


For example, 0750 gives rwx permissions to the owner and rx permissions to the group.



To give read/write/execute permissions to the owner and read/execute permissions to the group of a file named '/tmp/foo' which is on a Globus resource called '', you can use:


from gdcompute import *



To remove group execute permissions from the same file you can use:





A valid proxy certificate is required to use this function.


See also

gd_fileexists, gd_listdir




Copyright © 2005, The Geodise Project, University of Southampton