By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,400 Members | 903 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,400 IT Pros & Developers. It's quick & easy.

setting permissions to a file from linux.

P: n/a
Hi all,
I have a text file in a directory on unix system.
Using a python program i want to change that file's permissions.
How could this be done.

Thanks
Nov 18 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Nov 18, 2:36*pm, gaurav kashyap <gauravkec2...@gmail.comwrote:
Hi all,
I have a text file in a directory on unix system.
Using a python program i want to change that file's permissions.
How could this be done.

Thanks
help(os.chmod)
Help on built-in function chmod in module nt:

chmod(...)
chmod(path, mode)

Change the access permissions of a file.

or

os.system('chmod 775 /path/to/filename')
Nov 18 '08 #2

P: n/a
Chris <cw****@gmail.comwrote:
On Nov 18, 2:36?pm, gaurav kashyap <gauravkec2...@gmail.comwrote:
I have a text file in a directory on unix system.
Using a python program i want to change that file's permissions.
How could this be done.

Thanks

help(os.chmod)
Help on built-in function chmod in module nt:

chmod(...)
chmod(path, mode)

Change the access permissions of a file.
.... and just watch out that we usually supply the arguments to chmod
in octal, so you want

os.chmod(0775, "directory")

rather than

os.chmod(775, "directory")

(leading 0 implies octal)

--
Nick Craig-Wood <ni**@craig-wood.com-- http://www.craig-wood.com/nick
Nov 18 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.