Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

os.mkdir's rights assigning doesn't work as expected

Tags:

python

unix

I'm trying to create directory with 777 rights.

os.mkdir(Xmldocument.directory, 0777)

However what I get is 775

drwxrwxr-x. 2 mwysoki mwysoki 4096 Nov  9 11:38 VeloDBBrowser

I'm sure that I have appropriate rights because chmod 777 works just fine.

like image 332
Michal Avatar asked Nov 09 '11 10:11

Michal


1 Answers

The current umask is applied here as well.

Normally, files are created with 0777 (if executable or directory) or 0666 (other files.)

Then the OS applies the current umask to this value, resulting into 0755 resp. 0644 seen on most files, as the most usual umask is 0022.

Your solution would be to set the umask to 0.

like image 166
glglgl Avatar answered Sep 21 '22 13:09

glglgl