I've a directory mnt
with 777 permissions:
drwxrwxrwx 2 root root 14336 Feb 5 15:52 mnt
I've created a bunch of users in the group root
from uid to 5204
to 5250
.
I've a python script that launches a bunch of processes which:
- Change the uid to one of those I created earlier
- Create a file under
mnt
directory
but I keep getting IOError: [Errno 13] Permission denied:
. What am I missing?
Here's the python script I am using:
from multiprocessing import Process import random import time import os def test_function(name, uid): os.setuid(uid) fname = "/home/username/mnt/file-%s-%d" % (name, random.randrange(100)) print "Will open file: %s\n" % fname file = open(fname, 'w+') file.close processes = [] for m in range(5204, 5212): name = 'Thread-%s' % str(m) p = Process(target=test_function, args=(name, m)) p.start() processes.append(p) for p in processes: p.join()
Note: I run this python script with root permissions and mnt
is an NFS directory mounted with Amazon EFS
os.setuid(uid)
? – Johan Myréen Feb 5 '17 at 16:44print (os.environ)
? – Michael D. Feb 5 '17 at 17:57