I have some trouble installing some packages I compiled from source. Everything seems to work fine, until I try to actually use the files installed in a global place.
It turns out the permisions and users/groups of the newly created files are all messed up. It is very easy for me to replicate with a simple directory and file creation commands:
$ sudo mkdir /usr/local/bar
$ sudo touch /usr/local/bar/foo
$ ls -l /usr/local
total 11M
drwxr--r-- 2 root root 4,0K jul 24 23:56 bar/
[...]
$ ls -l /usr/local/bar/
ls: cannot access '/usr/local/bar/foo': Permission denied
total 0
-????????? ? ? ? ? ? foo
$ sudo ls -l /usr/local/bar/
total 0
-rw-r--r-- 1 root root 0 jul 24 23:56 foo
As seen by the example above, the created directory looks fine initially, but when looking inside it the user, group and everything else for the files is totally messed up. They do look fine when looking at it from the superuser perspective with sudo
.
Using chown
or chmod
doesn't matter, as long as I use sudo
whatever I do results in the same problem.
My /etc/sudoers
file (without comments):
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
root ALL=(ALL:ALL) ALL
%admin ALL=(ALL) ALL
%sudo ALL=(ALL:ALL) ALL
#includedir /etc/sudoers.d
myusername ALL=NOPASSWD: ALL
It should all be default, except for the last line which I added to not have to write the password every time.
I have a fully up-to-date 16.04 installation.
Could it be something wrong with my installation? Something wrong with sudo
or how I use it? Anything else?
Output of umask -S
as requested:
$ umask -S
u=rwx,g=r,o=r
$ sudo bash -c "umask -S"
u=rwx,g=r,o=r
And
$ grep '^UMASK\|^USERGROUPS_ENAB' /etc/login.defs
UMASK 033
USERGROUPS_ENAB no
umask -S
andsudo bash -c "umask -S"
please?grep '^UMASK\|^USERGROUPS_ENAB' /etc/login.defs
please and I'll write an answer for you :)UMASK
? Do you need the changes? Because the problem here is that you do not give execution permissions by default, but those are needed to browse a directory. Without that, you are not able to list new directories' contents.