How to Get the SNMP Community String in Linux

Updated July 20, 2017

Simple Network Management Protocol (SNMP) is a network protocol used to manage and monitor network devices. To provide a level of security, SNMP uses a community string that acts in a similar way as a password. If a request is made to an SNMP-enabled device, the community strings must match between the two devices to make a response. Changing the default community string is a security best practice.

Load a shell prompt.

Enter "cd /etc./snmp/" and press "Enter."

Enter "vi snmpd.conf" and press "Enter."

Find the line that starts with "rocommunity"; the rest of this line is the SNMP community string.

Load a shell prompt.

Enter "cd /etc./snmp/" and press "Enter."

Enter "vi snmpd.conf" and press "Enter."

Edit the line that starts with "rocommunity," leave a space after this and then enter the new string that you wish to use as the SNMP community string. Save the file.

Enter "service snmpd stop" and press "Enter."

Enter "service snmpd start" and press "Enter." This will start the SNMP service up with the new community string.


To improve security on your SNMP-enabled devices, always make sure you change the default community name of "public" to something longer and more complex.


Take a backup of the snmpd.conf file before making any changes. An incorrect syntax in the file can prevent the SNMP service from starting up.

Cite this Article A tool to create a citation to reference this article Cite this Article

About the Author

Ed Stanyer is a blogger and technical writer who began his writing career in 2008. He has several successful technical blogs and has published technical pieces and software reviews for a variety of websites. Stanyer spent four years studying information technology at Lichfield, Staffs College and is a Cisco-certified Network Specialist.