Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4584566
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:22:21+00:00 2026-05-21T21:22:21+00:00

My command is echo root_password | sudo -u root -S executable_full_path arguments The error

  • 0

My command is

echo root_password | sudo -u root -S executable_full_path arguments

The error message I get in the browser is

[sudo] password for www-data: Sorry,
try again.

From phpinfo(), safe mode is off and there are no disabled functions. Why isn’t this working? The same command runs fine in the shell (bash). Escapeshellarg and escapeshellcmd don’t make a difference.

EDIT: Simply being able to execute the command is not enough. The program that gets executed creates a socket in /tmp, and needs to assign it permissions. So I think I really need to be root for this, is that possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T21:22:22+00:00Added an answer on May 21, 2026 at 9:22 pm

    As Álvaro suggested, I’m putting my comment as answer. Matt, this would make it possible to run that command as root.

    @Matt, don’t do that /etc/sudoers (btw, you edit this file with the visudo command, never directly). That way you are making possible that any sudo whatever command run by your web application is run by root, possibiliting a lot of fun for an attacker if he founds a vulnerability in your application.

    If you would like to run just ONE command as root without need for passwords, put this in /etc/sudoers (remember visudo command):

    www-data ALL=(ALL) NOPASSWD: executable_full_path
    

    Then you are only allowing to execute just this command as root. Now you should be able to do

    sudo -u root executable_full_path arguments
    

    without need to type in a password (and it will run as root). Also, this is the only command the user www-data may execute as root using sudo, so it should not be dangerous.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using GNU bash, version 3.00.15(1)-release (x86_64-redhat-linux-gnu). And this command: echo -e doesn't print
How do I execute the following shell command using the Python subprocess module? echo
I am trying to execute a shell command via: <php echo shell_execute(tac /home/kusmuk/access-logs/kusmuk.org); ?>
I have the following command find . -name *.tiff -exec echo `basename -s .tiff
What command checks if a directory exists or not within a Bash shell script?
Via command line, I usually do this: cp -rRp /path/to/a\_folder/. /path/to/another\_folder This copies just
Which command will executed first,If a stored procedure have individual multiple select commands;
The (command line) interface I have in mind is like so: watching FILE+ do
What command line util can i use to create a thumbnail preview of a
How does Google Chrome command and control multiple cross platform processes and provide a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.