warning: cannot open /etc/hosts.allow: Permission denied

Issues related to applications and software problems
becho
Posts: 13
Joined: 2020/04/21 13:45:59

warning: cannot open /etc/hosts.allow: Permission denied

Post by becho » 2020/04/21 14:16:24

While running systemctl status
I m getting the message
warning: cannot open /etc/hosts.allow: Permission denied
warning: cannot open /etc/hosts.deny: Permission denied

How can I fix this ?

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: warning: cannot open /etc/hosts.allow: Permission denied

Post by TrevorH » 2020/04/21 14:27:22

What is the output from the commands:

uname -a
rpm -V setup
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

becho
Posts: 13
Joined: 2020/04/21 13:45:59

Re: warning: cannot open /etc/hosts.allow: Permission denied

Post by becho » 2020/04/23 07:51:07

the warning shows when checking systemctl status rpcbind and is also in var/log/messages
and the services cant restart

/etc/hosts.allow and /etc/hosts.deny permission is 644

Any idea??

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: warning: cannot open /etc/hosts.allow: Permission denied

Post by TrevorH » 2020/04/23 08:05:42

Only when you answer the questions I asked...
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

becho
Posts: 13
Joined: 2020/04/21 13:45:59

Re: warning: cannot open /etc/hosts.allow: Permission denied

Post by becho » 2020/04/24 11:46:13

Linux 3.10.0-1062.18.1.el7.x86_64 #1 SMP Tue Mar 17 23:49:17 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
.M....... c /etc/aliases
.M....... c /etc/bashrc
.M....... c /etc/csh.cshrc
.M....... c /etc/csh.login
.M....... c /etc/environment
.M....... c /etc/exports
.M....... c /etc/filesystems
.M....... c /etc/fstab
.M....... c /etc/group
.M....... c /etc/gshadow
.M....... c /etc/host.conf
.M....... c /etc/inputrc
.M....... c /etc/motd
.M....... c /etc/passwd
.M....... c /etc/printcap
.M....... c /etc/profile
.M....... /etc/profile.d
.M....... c /etc/profile.d/csh.local
.M....... c /etc/profile.d/sh.local
.M....... c /etc/protocols
.M....... c /etc/services
.M....... c /etc/shadow
.M....... c /etc/shells
.M....... c /etc/subgid
.M....... c /etc/subuid
.M....... d /usr/share/doc/setup-2.8.71/COPYING
.M....... d /usr/share/doc/setup-2.8.71/uidgid

becho
Posts: 13
Joined: 2020/04/21 13:45:59

Re: warning: cannot open /etc/hosts.allow: Permission denied

Post by becho » 2020/04/25 10:32:15

polkit service also failed shows authorization failed

Can you respond soon? Thanks

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: warning: cannot open /etc/hosts.allow: Permission denied

Post by TrevorH » 2020/04/25 12:46:41

Did you run rpm -V setup as root?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: warning: cannot open /etc/hosts.allow: Permission denied

Post by TrevorH » 2020/04/25 13:31:29

Also, from man rpm the M flag means

M Mode differs (includes permissions and file type)

So you have changed the permissions of all of those files listed there away from the defaults. I would suggest not doing that. Perhaps yum reinstall setup or rpm --setperms setup && rpm --setugids setup will restore them to what they should be.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

becho
Posts: 13
Joined: 2020/04/21 13:45:59

Re: warning: cannot open /etc/hosts.allow: Permission denied

Post by becho » 2020/04/25 19:44:38

Thanks for the response.You are right there was some mess with permissions.
I tried the rpm --setperm .....option now rpm -V setup shows nothing but
the problem is still there
rpcbind[2349]: connect from 10.0.91.2 to getport/addr(1...st
rpcbind[1078]: warning: cannot open /etc/hosts.allow: P...ed
rpcbind[1078]: warning: cannot open /etc/hosts.deny: Pe...ed
and
● polkit.service loaded failed failed Authorization Manager
● rpc-statd.service loaded failed failed NFS status monitor for NFSv2/3 locking.
● systemd-hostnamed.service loaded failed failed Hostname Service

i didnt restart after the rpm --setperm setup

becho
Posts: 13
Joined: 2020/04/21 13:45:59

Re: warning: cannot open /etc/hosts.allow: Permission denied

Post by becho » 2020/04/27 06:25:35

I restarted and problem still persists

nfs-server status is active exited

and after restart or when logging in to a new kernel rpc bind starts ok at first then when nfs starts all the problem shows up again

can you respond soon please

Post Reply