1

I'm completely new to the Linux world, but I've been able to complete a few tasks on my own.

Now, I have a task to complete that's driving me crazy.

I need to be able to send the password to sudo, since I can't prompt the user for the password.

What I've been able to find is

echo myPassword | sudo -s

Apparently -s allows sudo to receive the password through command input, and not user input.

I can't render my user so sudo won't ask me for password, since I don't know who will use this script, the script has access to their password and account names, the only thing I need it to be able to automate sudo.

PS: English is not my native language, sorry if I made any mistakes.

Mike Cluck
  • 31,869
  • 13
  • 80
  • 91
MrUglama
  • 43
  • 1
  • 4
  • 1
    First, it is `-S` Uppercase, not `-s` lowercase (which change the shell). Second, why can't you prompt your users for a password? Third: What do you mean by "I can't render my user so sudo ...."??. –  Sep 08 '15 at 17:07
  • sorry, i dont how to express my self, i cant change the sudoers file so the system wont ask for a password, and i cant prompt my users for a password because this part of the script is supposed to be hidden. – MrUglama Sep 08 '15 at 18:04
  • Under the conditions you state, there is no solution I can give. –  Sep 08 '15 at 19:02
  • damn, thanks :), do you know why "echo myPassword | sudo -S" wont work? – MrUglama Sep 08 '15 at 19:33

0 Answers0