Ankit
Ankit

Reputation: 3

Can anyone explain how to shutdown the Linux system using system command?

I stuck in a problem, I want to shutdown the Linux PC using system command but my machine is asking to enter the password.

here is the scenario: I'm using 2 systems one is windows and another one is Linux. I'll send the command to Linux for shutdown, this Linux PC application made it as Service file, once I receive the command for shutdown, My Linux PC run the system function which is written like this system("shutdown -P now"); if I run this command my machine won't execute the command.

Kindly help me out in this! Thanks & Regards

Upvotes: 0

Views: 436

Answers (1)

Madhuraj Vadde
Madhuraj Vadde

Reputation: 1227

thank you Some programmer dude for your valuable feedback. Posting your suggestion as answer to help other community members.

The shutdown command needs super-user privileges. You can use some additional commands to elevate the privileges along with the command you are currently using.

Upvotes: 0

Related Questions