pap0007
Posts: 3
Joined: Sun Jan 14, 2018 11:15 am

Headless operation, need to remote in

Sun Jan 14, 2018 11:54 am

Hello all-

First, thank you for any and all assistance. These communities are paramount for progressing. I am a noob to pi (and a beginner with linux) and have taken an interest. i purchased a pi 3b just to tinker, realized i really like the pi-hole project and found that i can buy a zero to permanently install and get back my 3b to once again, tinker.

i have pi-hole setup on the zero but i realize once i run it "headless" i won't be able troubleshoot any issues unless i can remote in. i found articles on this topic, but only one that showed me how to make the vnc server start on computer startup, which is needed. it uses tightvnc and located here: http://www.penguintutor.com/linux/tightvnc . everything worked fine (i was able to connect from an iPad using vncviewer) until i got to "securing tightvnc" and i want to do this. i added the -localhost to the tightvncserver.service file. i restarted the pi. now i can't login as normal, no problem. but the next line isn't clear to me- "To login using ssh - first login to the host computer using ssh.
ssh pi@192.168.1.6 -L 5901:localhost:5901" i am supposed to run this line from the client i guess? i tried to download an app to do this from the iPad, that didn't seem reliable so i am trying from my mac. after i change the ip to my pi ip, that returns "ssh: connect to host (my pi ip) port 22: connection refused" . also when i try further down the article, the windows putty method, that returns connection refused as well. so i guess its a network issue. i look at net stat -pln on the pi, unlike before i added localhost to the service file, it is now listening to port 5901 coming from 127.0.0.1 instead of 0.0.0.0. so i guess im missing the method here of getting the pi to think im connecting as localhost...something like that. i also don't quite understand why the mac error has port 22 in there, i figured id be using port 5901, maybe thats a problem. can anyone shine some light? maybe there is something small im missing? maybe im way off base and there is a much easier way to auto start a vnc server that is using ssh? thank you so much for any help, sorry for the book :)


robjak
Posts: 26
Joined: Sun Mar 12, 2017 7:22 pm

Re: Headless operation, need to remote in

Mon Jan 15, 2018 12:06 am

ssh uses port 22
vnc display1 one uses 5901

You are creating a tunnel via ssh so you need ssh enabled via raspi-config

pap0007
Posts: 3
Joined: Sun Jan 14, 2018 11:15 am

Re: Headless operation, need to remote in

Mon Jan 15, 2018 2:27 am

Robjak, you are the best. thank you. doing so now my mac lets me create that tunnel. however, in the next step of the instruction, it says to run "xtightvncviewer 127.0.0.1:1. unfortunately i guess i don't have this program on my computer. so. i tried it with windows, still refusing the connection. i don't see the ip of the pi anywhere in that instruction so i guess im missing something. i try to use a different program on my mac (i looked quickly at tightvnc.com and only see downloads for windows) and i tried screen sharing and realvnc, both still say connection refused. do you know of a program i can use for vnc viewer from a mac to connect to pi running tightvnc over ssh? thank you again!!!

robjak
Posts: 26
Joined: Sun Mar 12, 2017 7:22 pm

Re: Headless operation, need to remote in

Mon Jan 15, 2018 4:07 am

post edited.
Last edited by robjak on Mon Jan 15, 2018 7:21 pm, edited 1 time in total.

robjak
Posts: 26
Joined: Sun Mar 12, 2017 7:22 pm

Re: Headless operation, need to remote in

Mon Jan 15, 2018 4:32 am

post edited.
Last edited by robjak on Mon Jan 15, 2018 7:21 pm, edited 1 time in total.

robjak
Posts: 26
Joined: Sun Mar 12, 2017 7:22 pm

Re: Headless operation, need to remote in

Mon Jan 15, 2018 4:44 am

run the ssh session to the pi

ssh pi@yourIP -L 5901:localhost:5901 or via putty with tunnel set per instructions on your posted link.

the use the viewer on you mac/ipad/windows use address 127.0.0.1:1 or maybe 127.0.0.1:5901

it took me a little bit but i did get it to work with realvnc. it should work the same with tightvnc

robjak
Posts: 26
Joined: Sun Mar 12, 2017 7:22 pm

Re: Headless operation, need to remote in

Mon Jan 15, 2018 4:55 am

there is a realvnc viewer for mac. https://www.realvnc.com/en/connect/down ... wer/macos/

not sure if realvnc viewer would work with tightvnc server.

uninstall tightvnc then enable realvnc in raspi-config
https://www.raspberrypi.org/documentati ... ccess/vnc/

User avatar
DougieLawson
Posts: 40126
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Headless operation, need to remote in

Mon Jan 15, 2018 1:54 pm

Best thing is RealVNC Cloud. You don't need SSH tunnels, you don't need anything open through your firewall. You can access your RPi desktop from anywhere in the world with any RealVNC client.

https://www.raspberrypi.org/blog/get-ba ... c-connect/

https://www.realvnc.com/en/connect/docs/faq/cloud.html
https://www.realvnc.com/en/news/what-vnc-cloud/
Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

klricks
Posts: 7279
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Headless operation, need to remote in

Mon Jan 15, 2018 2:14 pm

robjak wrote:
Mon Jan 15, 2018 4:32 am
what i wrote above is wrong.
Then edit your post(s) and fix it so it doesn't confuse other readers who stumble upon this thread.
You can change the wrong text to strikethrough characters if you wish to preserve the original.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

robjak
Posts: 26
Joined: Sun Mar 12, 2017 7:22 pm

Re: Headless operation, need to remote in

Mon Jan 15, 2018 7:19 pm

Sorry did not see the edit button. Thought there wasnt one. I see it now.


Also, the realvnc cloud option could be what you are looking for.

pap0007
Posts: 3
Joined: Sun Jan 14, 2018 11:15 am

Re: Headless operation, need to remote in

Sat Jan 20, 2018 12:36 pm

Robjak and Dougie, thank you. Sorry its been a few days for my reply. i started out using the default and better looking realVNC. but i needed the program to start automatically when the pi booted, because i will be moving it from a headed setup to a non headed setup, and if it doesn't start automatically, i will not be able to control it. the only article i saw on how to set that up was using tightVNC, the article above.

I did finally get this working after not looking at it for a few days. I really wanted to get it working the rudimentary method, to gain an understanding. but i could really see how the cloud solution would take away some of the semantics.

thank you both for your input. i hope to see you around the forum.

thanks

-Kevin

klricks
Posts: 7279
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Headless operation, need to remote in

Sat Jan 20, 2018 2:20 pm

pap0007 wrote:
Sat Jan 20, 2018 12:36 pm
....but i needed the program to start automatically when the pi booted, because i will be moving it from a headed setup to a non headed setup, and if it doesn't start automatically, i will not be able to control it...........
Once VNC is enabled with sudo raspi-config it is automatically configured to run at boot. You only need to connect from remote computer.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

Return to “Troubleshooting”