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
Post a Comment