My goal is use sudo
to write content to another user's xstartup
file.
But my attempt...
sudo -iu user1 bash -lic 'cat > ~/.vnc/xstartup <<\EOF
...
EOF'
...results in...
bash: warning: here-document at line 0 delimited by end-of-file (wanted `EOF...EOF')
Yet nested heredocs works...
sudo -iu user1 bash -s <<\OUTER
cat > ~/.vnc/xstartup <<\EOF
...
EOF
OUTER
Any suggestions to accomplish a sudo redirection without nested heredocs?
You have a lot of unnecessary layers.
sudo -u user1 tee ~user1/.vnc/xstartup > /dev/null <<\EOF
...
EOF