Error in CentOS - The effective user ID is not 0. Have you properly installed sudo as setuid root?

After coming across a similar question with the same headline, I realized that my situation is slightly different.

While setting up a new project, I encountered an issue with installing nodejs. It seemed to only work when using sudo, for example, sudo npm.

I decided to visit this link https://docs.npmjs.com/getting-started/fixing-npm-permissions and executed

sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

in order to change the default directory permissions. Since I had to use sudo npm here as well, I then ran

sudo chown -R $(whoami) $(sudo npm config get prefix)/{lib/node_modules,bin,share}

Following this, everytime I try to use sudo, I encounter this error -

sudo: effective uid is not 0, is sudo installed setuid root?

I realize that my setup for npm should have been different and not root, but being new to Linux, I am still learning.

Any assistance would be greatly appreciated. :)

Additional details -

ls -l $(which sudo) gives =>

---s--x--x. 1 dev root 123832 Aug 13 2015 /usr/bin/sudo

Answer ā„–1

The issue at hand may stem from alterations to the permissions of the folder /usr/bin.

To rectify this problem:

1) Firstly, ensure that root is the owner of the directory /usr/bin:

chown root:root /usr/bin

2) Next, adjust the permissions for this directory:

chmod u+s /usr/bin/sudo

Answer ā„–2

For those encountering ongoing sudo issues, I managed to resolve them by investigating the shell access of the user account in WHM. The problem stemmed from Jailed Shell restrictions on the account, causing the error to persist. By changing the shell setting to normal, the issue was successfully resolved.

Answer ā„–3

Problem: sudo command is not functioning properly due to incorrect permissions.

Observation: ---s--x--x. 1 dev root 123832 Aug 13 2015 /usr/bin/sudo

The user and group should be set to root, and the sudo file should have setuid permission.

Corrected Version: ---s--x--x. 1 root root 123832 Aug 13 2015 /usr/bin/sudo

Additionally, need to ensure proper permissions are double checked.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is it possible for a mobile device to play .ogg videos?

Currently, I am setting up a server to stream videos using HTML. So far, I have tested playing both .mp4 and .ogg video formats on my computer successfully. However, when I attempted to play the same videos on a mobile device, only the .mp4 file showed u ...

Node.js: Troubleshooting a forEach Function Error

I am encountering an issue with my nodejs script that is causing a "function not found" error after trying to insert data from json files into Firestore. How can I resolve this? Thank you for your help. Below is my code snippet: var admin = require("f ...

Testing the mirkoORM entities at a unit level

Trying to perform a unit test on a method within a MikroORM entity, I am attempting to populate a mikroORM collection field with test data. Specifically, I am using jest for this task: describe('Team Tests', () => { it('isLeader shoul ...

Adding an index to mongodb in a Dokku installation through the import process

I have recently deployed an application on an Ubuntu server using Dokku. The app is built with Node.js and relies on a MongoDB database. In order for the website to function properly, I must load a geojson file into the database. While I was able to accom ...

The issue arises when nuxt.js is set to spa mode and the root path is not correctly configured on a

English is not my strong suit, apologies in advance. I have a Nuxt project set up like this. Operating in spa mode. Folder Structure pages - index.vue index |_ child.vue |_ index.vue pages/index.vue <template> < ...

Refresh the context whenever the state object changes

Within my application, I am utilizing a PageContext to maintain the state of various User objects stored as an array. Each User object includes a ScheduledPost object that undergoes changes when a user adds a new post. My challenge lies in figuring out how ...

interrupt the node script using async behavior

I encountered an issue while running the npm install command to install a list of modules on Node, specifically related to async. TypeError: undefined is not a function What could be causing this problem? var fs = require( "fs" ), path = require( ...

NodeJs took an unexpected turn

Iā€™m encountering an issue with an http request to forecast.io. When I make a normal request using $.ajax, everything works fine. However, when I try using the ajax-request module, I receive the following output: SyntaxError: Unexpected token u in JSON at ...

The procedure for installing the most recent version of Node JS on Windows 7

I am facing a dilemma with my workflow that requires nodejs v16, however, due to platform restrictions the latest version is not available on Windows 7. I have been using Windows 7 because my computer has low performance and only 4GB of RAM. Despite tryi ...

Encountering a top-level-await issue while utilizing the NextJS API

Currently, I am in the process of creating an API using NextJS and MongoDB. To start off, I have set up some basic code at the beginning of the API file: const { db } = await connectToDatabase(); const scheduled = db.collection('scheduled'); Fol ...

What is preventing npm sass from compiling properly?

https://i.stack.imgur.com/ekbNW.png While making edits to my code, I've noticed that the sass-compiler isn't indicating any errors (red lines) or successful compilations (green lines). Can someone help me identify where I might be going wrong? ...

Encountering the error message "Module not found: '@babel/runtime/helpers/builtin/objectSpread'" after upgrading to Meteor version 1.6.1.1

After updating my meteor project to Meteor 1.6.1.1, I encountered the following error message: => Exited with code: 1 W20180403-15:33:17.531(2)? (STDERR) E:\Personnal folders\quicktext5\.meteor\local\build\programs&bsol ...

Is it possible to invoke a router from a different route that is currently loaded in a Node.js application

I successfully loaded the root route. app.get('/', (req, res, next) => { // code to load an HTML page }); After loading the HTML page with a submit button on it, upon submission we navigate to the "search" route. The "/search" route is ...

Is the utilization of React.js restrictive when it comes to employing a node.js server?

After dedicating a month to working with React.js, I have primarily utilized the Webpack dev server, powered by node.js Express. This server has allowed me to effectively render React.js on a browser. However, I am curious to know if using React.js means w ...

Enhancing Your Sequelize Package

Recently, I encountered an issue with my App while trying to upgrade the Sequelize npm package from version 4.22.7 to the latest version (5.21.7). After the upgrade, I noticed a TypeError in my logs that pointed to the following code snippet: **export def ...

Recursive function in JavaScript with error handling using try-catch block

Within my nodejs script, I have implemented a system to generate dynamic tables and views based on the temperature data recorded for the day. On some occasions, the creation of these tables is hindered if the temperature falls outside of the normal range ...

Establish a PeerJS server in conjunction with Express

Currently, I am in the process of setting up my own peerJS server by following the instructions provided in the README found at https://github.com/peers/peerjs-server#combining-with-existing-express-app This is the code on my server: port = process.env.P ...

Utilize the version designated in the package.json file for your NPM script

Currently, I am working on an npm script that involves starting up a server and building to a specific directory in my project. Within this directory, there is a sub-directory that matches the version of my app specified in the package.json file. { name: ...

Transmit an array using RabbitMQ

I'm trying to figure out how to send an array of messages using RabbitMQ without having to send each message individually. How can I achieve this? For instance: ch.publish(ex, '', new Buffer('hello world')); Is there a way to do ...

Effective Interval and Range Handling in LUIS Application

Creating a LUIS App that requires understanding time/date ranges semantically is my current project. When I say "semantic," what I am aiming for is the ability to resolve examples like these: Last week -> start: 2019-09-02T00:00:00+00:00; end: 2019-09 ...