I have a shell script that installs several programs with sudo apt-get then opens vncserver, then installs more stuff.
This works:
#!/bin/sh
vncserver
>./my_script.sh
But this does not work:
#!/bin/sh
sudo apt-get update
vncserver
>./my_script.sh
Nor does this work:
#!/bin/sh
vncserver
>sudo ./my_script.sh
When it doesn't work, it returns the error vncserver: Wrong type or access mode of /home/username/.vnc
.
Someone on this question said that this was a known problem. So how can I run vncserver in my_script?
sudo <the-script>
does it work? – George Udosen Jul 04 '19 at 16:52>
you have there? Is that actually part of your script?>./my_script.sh
will just empty the file./my_script.sh
. What is the username in the error message? Is that your username or root's? – terdon Jul 04 '19 at 17:22