Writing timer job against Managed Metadata Service Application

Have you ever written a timer job in SharePoint to read from or writing to a term store in Managed Metadata, you might have done so and faced the error:

The current user has insufficient permissions to perform this operation

Even if you try to run the code with SPSecurity.RunWithElevatedPrivileges(), or with your own account from Visual Studio, it will still give you the same problem.

The thing is, that the timer job runs with its own service, which is “SharePoint 2010 Timer”, see the below image.

The user running this service has to have access to the term store administrators in Central Administration, see the image below:

Once permission is given here, you will start having access from your timer job to the managed metadata term store and create your desired term sets and terms.