Android phone as wifi and web browser server

Moderators: kirk, jamesbond, p310don, JakeSFR, step, Forum moderators

Post Reply
fatdoguser
Posts: 175
Joined: Sat Aug 05, 2023 10:54 am
Has thanked: 22 times
Been thanked: 79 times

Android phone as wifi and web browser server

Post by fatdoguser »

Visit and download/install f-droid
Use that repo to install termux
Within termux install OpenSSH and set it up so you can run
sshd
and are able to ssh into your phone from your laptop. Android adds 8000 to ssh port numbers so its
ssh -p 8022 <ip of phone>
to connect to the phone from your laptop rather than just port 22

I usb tether for that, needed the 'correct' usb cable to be able to tether, my original usb chord was a power/charge lead only, didn't support tethering.

Then in termux

pkg install x11-repo
pkg install termux-x11
pkg install tigervnc
pkg install jwm
pkg install otter-browser
pkg install aterm

and run
vncserver -localhost
enter a password and then kill that vncserver
vncserver -kill :1
Edit ~/.vnc/xstartup and change the twm & last line to just
jwm
(with no & background)
and restart vncserver again
vncserver -localhost

Will likely grab DISPLAY :1, which for vnc ports has 5900 added to that, so on your laptop set up a ssh tunnel
ssh -p 8022 -f -N -L 5900:localhost:5901 <ip of phone>
and use vncviewer to access that
vncviewer localhost

Assuming your phone is wifi net connected (or has 'data' turned on), you'll have usual otter browser (that is like Opera) internet access.

otter.png
otter.png (84.2 KiB) Viewed 666 times

Rather than using termux to type commands in such as
DISPLAY=:1 otter-browser &
you can alternatively ssh in and run that via a laptop terminal window

I didn't keep notes, more trial and error so I'm going from memory as to what did eventually work and may have missed things out. I additionally installed fonts and copied across a .jwmrc file to make aterms font size larger. Also for the browser I used a

Code: Select all

QT_SCALE_FACTOR=1.7 GDK_SCALE=2 otter-browser

launch scale factor as otherwise the menu fonts were too small for comfort.

On my phone I can retrieve the phones IP via the Network, tapping the connected wifi item and then Advanced and after a few pages of scrolling the phones IP is shown. Testing download speed and I got 40Mbs throughput (for wifi connected).

The phone doesn't need to have been rooted, however I have just tried to extend /etc/hosts and was blocked from doing that. Everything seemed to work OK in otter until I tried logging into this forum, when a error occurred, might have just been circumstances at the time, maybe something else (more permanent), I need to do more investigating/testing, such as if whether you can also wifi ssh into the phone from the laptop (hotspot) rather than tether via usb, and still have the browser work via wifi internet connection.

I did come across a example somewhat similar to the above but also extended to use scrcpy and adp so that sounds were also conveyed, but I lost that link as part of my trial and error testing.

Last edited by fatdoguser on Sun Dec 24, 2023 4:35 am, edited 3 times in total.
fatdoguser
Posts: 175
Joined: Sat Aug 05, 2023 10:54 am
Has thanked: 22 times
Been thanked: 79 times

Re: Android phone as wifi and web browser server

Post by fatdoguser »

@rockedge This is the error I'm getting when logging into forum.puppylinux.com from my phone running otter-browser (that I've vnc'd into through a ssh tunnel from my laptop that's usb tethered)

Not Acceptable

An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod Security.

Other (phpBB) sites work ok.

Attachments
puppylogin-fail.png
puppylogin-fail.png (175.81 KiB) Viewed 651 times
User avatar
rockedge
Site Admin
Posts: 5714
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1994 times
Been thanked: 2097 times
Contact:

Re: Android phone as wifi and web browser server

Post by rockedge »

@fatdoguser I have also run across this message, Can't recall the exact details and might be an adjustment the host provider admin's have to perform. I was able to eliminate the error from occurring in my case so I will look back at what I might have done.

I'll keep an eye out how to get a suitable fix. It is a feature in a module for the Apache web server causing it.

jamesbond
Posts: 540
Joined: Tue Aug 11, 2020 3:02 pm
Location: The Pale Blue Dot
Has thanked: 73 times
Been thanked: 292 times

Re: Android phone as wifi and web browser server

Post by jamesbond »

@fatdog, interesting experiments. I have termux in my phone for the longest time but never think of using it as a remote terminal. Perhaps I should give it a try too :thumbup:

fatdoguser
Posts: 175
Joined: Sat Aug 05, 2023 10:54 am
Has thanked: 22 times
Been thanked: 79 times

Re: Android phone as wifi and web browser server

Post by fatdoguser »

jamesbond wrote: Sat Dec 23, 2023 4:30 pm

@fatdog, interesting experiments. I have termux in my phone for the longest time but never think of using it as a remote terminal. Perhaps I should give it a try too :thumbup:

termux-api is a nice extension in addition to just termux @jamesbond

https://wiki.termux.com/wiki/Termux:API

Things like
termux-sms-send
termux-telephony-call
can be scripted/run from your laptop

I also tend to use ssh (scp) for file transfers from/to the phone. Never really got why ssh uses little p for the port number ssh -p 8022 whereas scp uses big P scp -P 8022

Neo_78
Posts: 351
Joined: Wed Dec 29, 2021 10:45 pm
Has thanked: 190 times
Been thanked: 9 times

Re: Android phone as wifi and web browser server

Post by Neo_78 »

Could you explain the exact use case scenario for accessing your Android phone via ssh and use vnc for web browsing from another device? @fatdoguser

Most users might use their Android phone as a Wifi hubspot or modem for their laptop.

Where do you see the benefits of this particular setup?

Also, why do use Otter browser? As far as I can see this browser has been updated in February 2022 the last time:

https://github.com/OtterBrowser/otter-browser

fatdoguser
Posts: 175
Joined: Sat Aug 05, 2023 10:54 am
Has thanked: 22 times
Been thanked: 79 times

Re: Android phone as wifi and web browser server

Post by fatdoguser »

Neo_78 wrote: Mon Jan 08, 2024 7:31 pm

Could you explain the exact use case scenario for accessing your Android phone via ssh and use vnc for web browsing from another device? @fatdoguser

Most users might use their Android phone as a Wifi hubspot or modem for their laptop.

Where do you see the benefits of this particular setup?

Also, why do use Otter browser? As far as I can see this browser has been updated in February 2022 the last time:

https://github.com/OtterBrowser/otter-browser

On my phone I installed f-droid
and then used that repo to install termux, along with X, tigervnc, ssh and other things, can't recall the exact details, pretty much like any package management install process.
I then set up sshd (ssh sever), so that I can ssh into that. I tether by a usb cable and run
udhcpc -qi usb0
in Fatdog to connect and be allocated a IP

For the phones IP (that changes) I just tap the connected wifi and select the advanced choice and some way down that list is shows the phones IP that can be used to ssh into.

With ssh you can also set up sshfs, a form of mounting so that you can use rox to drag/drop files from/to the phone. With tigervnc server running on the phone
vncserver :1
you can use vncviewer on the laptop to connect into that gui session, or set up a ssh tunnel and connect via that instead
ssh -p 8022 -f -N -L 5900:localhost:5901 <ip of phone>
vncviewer localhost
(assuming you ran vncserver :1 on the phone to start the vnc server listening on port 5901)

One of those spend a morning setting it all up, and then mostly forget about how you did it all, just run/use it once set up.

I like the tether for the added security (cabled (usb) rather than wifi), and as the laptop also charges the phone at the same time (mostly my laptop is connected to the mains as the laptop/battery are old and it doesn't hold its charge for that long, perhaps a hour of use only. My original usb cable didn't work for tethering, was power/charge phone only, but a power and tether cable was purchased for next to nothing in a local shop (a few dollars).

Otter was the first browser I came across, not too bothered about it being old as I consider my phone to be insecure, don't use it for payments, banking etc. just for convenience such as a voice google search for what time the next bus/train is, calls and sms's. Same as I'd use a internet cafe/library box for surfing. The otter has some nice features/layout, such as I like the zoom scroll option at the bottom of screen.

ssh and vnc is my common base, use it to connect/control both local and remote system, sshfs is icing, enabling files to be easily copied/moved between phone and remote server or my laptop. As ever the benefit is largely a factor of familiarity/ease of use. Others will likely have their own alternative choices, that may be easy for them but that I'd find to be unfamiliar/awkward.

fatdoguser
Posts: 175
Joined: Sat Aug 05, 2023 10:54 am
Has thanked: 22 times
Been thanked: 79 times

Re: Android phone as wifi and web browser server

Post by fatdoguser »

Neo_78 wrote: Mon Jan 08, 2024 7:31 pm

Could you explain the exact use case scenario for accessing your Android phone via ssh and use vnc for web browsing from another device? @fatdoguser

Most users might use their Android phone as a Wifi hubspot or modem for their laptop.

Where do you see the benefits of this particular setup?

Also, why do use Otter browser? As far as I can see this browser has been updated in February 2022 the last time:

https://github.com/OtterBrowser/otter-browser

I've made a start by posting here https://www.forum.puppylinux.com/viewtopic.php?t=10302 and that I intend to extend as/when time permits.

Post Reply

Return to “Software”