I've written a script that copies some files from one place to another and since I don't have permissions to the source folder, I tried running it with sudo. The problem is that now the creation of the destination folders fails. Here is a simple test case:
In my home directory the following works:
But this fails due to permission denied error
sudo mkdir testDir2
My home directory has 755 permissions and is own by me.
sudo groups and found that as expected the
root group is there, but strangely, the
users is not. Also running
groups as myself reveals that I'm not in the sudo group.
Any ideas what's going on? Why am I not able to write to my home folder when running with sudo?