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

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -