Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

merry christmas!

I have installed net-snmp, net-snmp-utils and net-snmp-devel in my 64-bit Centos5 using yum.

The following are the packages I've installed:

net-snmp-devel-5.3.2.2-14.el5_7.1
net-snmp-utils-5.3.2.2-14.el5_7.1
net-snmp-devel-5.3.2.2-14.el5_7.1
net-snmp-libs-5.3.2.2-14.el5_7.1
net-snmp-libs-5.3.2.2-14.el5_7.1
net-snmp-5.3.2.2-14.el5_7.1
net-snmp-perl-5.3.2.2-14.el5_7.1

Starting snmp,

[root@localhost ~]# /etc/init.d/snmpd start
Starting snmpd: /usr/sbin/snmpd: error while loading shared libraries: 
librpmdb4.4.so: cannot open shared object file: Permission denied
                                                           [FAILED]

But when I disable SELinux,

[root@localhost ~]# setenforce 0
[root@localhost ~]# /etc/init.d/snmpd start
Starting snmpd:                                            [  OK  ]

When I enable SELinux back, it can no longer start successfully.

[root@localhost ~]# setenforce 1
[root@localhost ~]# /etc/init.d/snmpd restart
Stopping snmpd:                                            [  OK  ]
Starting snmpd: /usr/sbin/snmpd: error while loading shared libraries: 
librpmdb-.4.so: cannot open shared object file: Permission denied
                                                           [FAILED]

What should I do? I need my SELinux to be enabled of course. Any configurations that can fix this one? Thanks in advance.


UPDATE

In order for my snmp service to work, I execute the command restorecon on the libraries involved on running the snmp.

restorecon -vv /lib64/libres* 
restorecon -vv /lib64/libnsl* 
restorecon -vv /lib64/libdl*  
restorecon -vv /lib64/libm* 
restorecon -vv /lib64/libcrypt* 
restorecon -vv /lib64/libutil*  
restorecon -vv /lib64/libpthread* 
restorecon -vv /lib64/libc* 
restorecon -vv /lib64/librpmdb* 
restorecon -vv /usr/lib64/librpmdb-4.4.so  
restorecon -vv /lib64/libselinux*  
restorecon -vv /lib64/libnss3*  
restorecon -vv /usr/lib64/libnss3.so
restorecon -vv /usr/lib64/libnssutil3.so  
restorecon -vv /usr/lib64/libplds4.so  
restorecon -vv /usr/lib64/libplc4.so 
restorecon -vv /usr/lib64/libnspr4.so   
restorecon -vv /lib64/librt.so.1  
restorecon -vv /lib64/librt*  
restorecon -vv /usr/lib64/libbz2.so.1 
restorecon -vv /usr/lib64/libbz2* 
restorecon -vv /lib64/libgcc_s*  
restorecon -vv /usr/lib64/libsysfs*  
restorecon -vv /usr/lib64/libsqlite3* 
restorecon -vv /usr/lib64/libelf*  
restorecon -vv /lib64/libsepol*  
restorecon -vv /lib64/ld-linux-x86-64.so.2  
restorecon -vv /lib64/ld-linux-x86-64* 
restorecon -vv /lib64/ld-2.5.so  

restorecon reset the security contexts of the above libraries from system_u:object_r:file_t:s0 to system_u:object_r:lib_t:s0

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

It might be the default security contexts is not set properly.

So, you can recursively restore the default security contexts by issuing the command as follow.

First change to the root dir.

#cd /
#restorecon -Rv .
share|improve this answer
add comment

You can use the following command to check the security context.

$ ls -alZ

You can use the following command to change it:

$ chcon
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.