linux - remote sudo from local script with local redirection -


okay i'm sure has been asked before life of me can't find answer (it's not possible / how it).

i have shell script script.sh runs command on remote server using:

    ssh -t [server] "[command executed remotely]" 

this works fine including if command contains sudo.

however, redirect output of script.sh , of course if remote command contains sudo sudo password prompt redirected also.

is there way to:

    ./script.sh > script.out 

and still remote sudo password prompt on terminal?

passing sudo password on cli script.sh not option.

many thanks,

alasdair.

you can use tee duplicate standard input:

./script.sh | tee script.out 

after can filter output awk command

./script.sh | tee script.out | awk '/^password/ {print;}' 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -