You have two problems that are not related to PostgreSQL.
sudo: /var/lib/sudo writable by non-owner (040775), should be mode 0700
The permissions of
/var/lib/sudo (or even whole upper directory trees) has been changed. These must be restored. If they has been changed for
/var/lib or even
/var, you have a problem because you will probably not know which permissions has to be set for each sub directory and file.
If you or a colleague with root access has changed the permission: Why?
If not, your system may be compromised.
In the latter case or when you have changed the permissions of whole directories you have to reinstall your Linux distribution.
[sudo] password for naeem:
You executed
sudo for the user
postgres but you are prompted for the password of the user
naeem. This is suspicious.
The command will be executed for that user which has no access to the file.