0

I learned from my earlier question What's the purpose of using `sudo -S` explicitly? that sudo accepts password not from stdin by default.

Why is that? Is it because of some security reason?

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
Tim
  • 101,790

1 Answers1

2

It's often useful to pipe input into sudo, such as being able to do echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope without the 0 being interpreted as the sudo password. If sudo accepted the password from standard input, that wouldn't work.