471,348 Members | 1,601 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

recursive chmod

46
Hi Guys,

I am very new to python but am enjoying the learning experience :)

I am creating a script that moves directories to a different location and I want the script to change/set the file permissions, for the directory and all the files in it, to be READ only?

So users can read the files, but not write to them or move them. copy is ok.

Using osx/unix

Anyone have any suggestions?

Thanks!
Jun 12 '07 #1
4 6826
ilikepython
844 Expert 512MB
Hi Guys,

I am very new to python but am enjoying the learning experience :)

I am creating a script that moves directories to a different location and I want the script to change/set the file permissions, for the directory and all the files in it, to be READ only?

So users can read the files, but not write to them or move them. copy is ok.

Using osx/unix

Anyone have any suggestions?

Thanks!
Check out the os module especially the os.chmod() function.

Thanks for joining!
Jun 12 '07 #2
ateale
46
Check out the os module especially the os.chmod() function.
Thanks ilikepython!

Do you know if setting the permissions to 555 will stop users from accidently being able to move the directory?
Jun 12 '07 #3
ilikepython
844 Expert 512MB
Thanks ilikepython!

Do you know if setting the permissions to 555 will stop users from accidently being able to move the directory?
Unfortunately, I'm sorry but I'm not a unix person so I can't help here. Perhaps another member could or you could make some searches on Google.

Also, don't forget to check the python documentation especially for the os, os.path, and stat modules.
Jun 12 '07 #4
ghostdog74
511 Expert 256MB
Thanks ilikepython!

Do you know if setting the permissions to 555 will stop users from accidently being able to move the directory?
you can test it out on the unix shell. chmod a directory to 555, chown to some user, say user1, then login as user2 and try to delete that directory.
Jun 13 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Daniel | last post: by
6 posts views Thread by Ask Josephsen | last post: by
1 post views Thread by Xuan Yuan | last post: by
4 posts views Thread by Ian N | last post: by
5 posts views Thread by Stewart | last post: by
2 posts views Thread by Freebird | last post: by
1 post views Thread by James Colannino | last post: by
3 posts views Thread by webhead | last post: by
3 posts views Thread by Rik | last post: by
1 post views Thread by lawrence k | last post: by
reply views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.