html - how to avoid printing 'echo' output with system command in C -


system("echo 'abcpasswd' | su - newusr -c 'ls -ltr'"); 

above code embedded in 'c' code generats binary , later called html page. above code prompts 'password' piped in command. end seeing prompt 'password:' in html rendered page.

how around ?. don't want prompt 'password:' seen on webpage.

for security reasons, su doesn't takes password everywhere else interactive terminal. option - full login not standard input reading.

you may use sudo can control better (read os manual it), beware using such in non interactive mode considered harmful...


Comments

Popular posts from this blog

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -

testing - Detect whether test has failed within fixture -

android - Create single AAR file from multiple modules using Gradle -