Page 1 of 4 123 ... LastLast
Results 1 to 10 of 37

Thread: HowTo: Remote Access Ubuntu using Firefox

  1. #1
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Thumbs down HowTo: Remote Access Ubuntu using Firefox

    HowTo: Remote Access Ubuntu using Firefox



    Introduction

    This how-to will show you how to make a vnc connection over the internet using firefox on the client. This how-to should work with any java capable browser, including (personal success with) internet explorer.

    You can skip the rest of this introduction if you know how to configure your router/firewall.


    Warning: The how to installs a (vnc) server and java and is a potential security risk as your Ubuntu box will be potentially accessible to anyone on the internet.


    Access over the Internet

    First you should strongly consider both a router and firewall.

    The most difficult part of allowing internet access to your Ubuntu server may be configuring your router and firewall ... and is the most difficult part of this how-to. Unfortunately this is sometimes difficult to enable and since each situation is unique I can only give some general pointers.

    If you do not understand IP addresses and ports you can think of your IP address as a physical address of say an apartment complex.

    IP address = your computer = street address
    Port = your server = apartment number




    Server IP

    The IP address of your VNC server is different on a LAN vs an internet connection. Your internet IP address is assigned by your internet provider.
    • You can check your IP address here (or elsewhere).


    The problem can occur if you use DHCP (rather then a static IP address) the internet IP address can change from time to time, most often when you reboot. Most internet service providers use DHCP.

    A potential solution is to register at dyndns, or similar service. dyndns will provide free service.

    You can then determine your vnc server IP address (from your client) via ping. ie ping <name_of_dyndns_server>


    Router

    You can skip this step if you connect directly to the internet.

    Assuming you use a router, you must configure your router to forward the correct port(s). The gory details of how to do this vary by router, you will need to refer to your routers manual (if you lost your manual, start with a google search).

    You will need to forward ports 5801 and 5901 (from your router to your /ubuntu server). Ports 5801 and 5901 are the default ports for this how-to, although you can use others.
    • 5801 to allow the java applet to establish a connection
    • 5901 for connection to the VNC server.


    Basically you will start the server with a :X The default port is 5800 + X , so with this how to we will be using :1 and a default ports of 5801 and 5901. You will need to specify the 5801 port you are connecting to at the time of connection (in your browser address box). You can start more then one server (ie :2 , :3, etc corresponding to ports 5802 + 5902 , 5803 + 5903, etc).

    See man vncserver for more information.


    Firewall

    This is very easy to do via Firestarter Ubuntu Wiki, a gui front end to IP Tables.
    • Be sure to configure firestarter to allow pings.


    Open the firestarter gui (Applications -> Internet -> Firestarter)

    In the "Policy" tab, under the "Allow service" section, right click anywhere in the white space.

    Select "Add rule"
    • Under "Port" enter the ports you want to enable (5801 and 5901). "Allow Anyone" unless you know the IP you are connecting from and want to restrict access.



    Repositories

    You will need to enable the commercial repositories on both Ubuntu server and client.

    I do this by adding these lines to /etc/apt/sources.list

    Code:
    gksu gedit /etc/apt/sources.list
    ## Uncomment the following two lines to add software from Canonical's
    ## 'commercial' repository. This software is not part of Ubuntu, but is
    ## offered by Canonical and the respective vendors as a service to Ubuntu
    ## users.
    deb http://archive.canonical.com/ubuntu gutsy commercial
    deb-src http://archive.canonical.com/ubuntu gutsy commercial
    Note: The above repos are for gutsy, you will need to use the commercial repos for your version (ie Dapper, Edgy, Feisty).

    Ubuntu Wiki Repositories Ubuntu


    Server setup

    1. Enable the commercial repos as above.


    2. Install by any means vnc-common, tightvncserver, and tightvnc-java

    Code:
    sudo apt-get install vnc-common tightvncserver tightvnc-java

    3. Post-install configuration of the tight vnc server.

    1. Edit the fonts path in /etc/vnc.conf

      Code:
      gksu gedit /etc/vnc.conf
      • For Feisty/Gutsy (7.04 and 7.10) add these lines jus after all the commented out font lines :
        $fontPath .= "/usr/share/fonts/X11/misc,";
        $fontPath .= "/usr/share/fonts/X11/100dpi/:unscaled,";
        $fontPath .= "/usr/share/fonts/X11/75dpi/:unscaled,";
        $fontPath .= "/usr/share/fonts/X11/Type1,";
        $fontPath .= "/usr/share/fonts/X11/100dpi,";
        $fontPath .= "/usr/share/fonts/X11/75dpi,";
      • For earlier versions of Ubuntu, see this link : VNCOverSSH Ubuntu Wiki
    2. Setup the server.
      • Open a terminal and enter:
        Code:
        vncserver :1
      • The first time you run a server you will be asked a password:
        ubuntu@ubuntu:~$ vncserver :1

        You will require a password to access your desktops.

        Password: #Enter your desired password here
        Verify: #Confirm Password

        New 'X' desktop is ubuntu:1

        Starting applications specified in /etc/X11/Xsession
        Log file is /home/ubuntu/.vnc/ubuntu:1.log

        ubuntu@ubuntu:~$
        This password is our only security so choose well
      • Note: The name of your server is your hostname:1
      • This creates a new directory in your home directory ~/.vnc
        The vnc server will give access to your ubuntu server as the user who started the server.
      • Your password is encrypted in ~/.vnc/passwd
      • You can change your password with:
        Code:
        vncpasswd ~/.vnc/passwd
      • The vncserver uses ~/.vnc/xstartup to start/configure your session. These are the start scripts I find most helpful :
        1. Gnome
          ##!/bin/sh

          xrdb $HOME/.Xresources
          xsetroot -solid navy # Choose your color
          x-window-manager &
          {
          (gnome-panel 2> /dev/null &)
          }
          xterm &
        2. XFCE
          ##!/bin/sh

          xrdb $HOME/.Xresources

          xfwm4 2> /dev/null &
          xfce4-panel 2> /dev/null &
          xfce4-terminal &
        3. KDE
          ##!/bin/sh

          xrdb $HOME/.Xresources
          xsetroot -solid navy # Choose your color
          x-terminal-emulator -geometry 80x24+10+1- -ls -title "$VNCDESKTOP Desktop" &
          x-window-manager &
          kicker 2> /dev/null &

        Of the 3, IMO, XFCE gives the best results
      • Restart the server (to re-load the configuration/xstartup)
        Code:
        vncserver -kill :1
        vncserver -geometry 800x600 -depth 24 :1


      See man vncserver for additional options



    4. Start the server (later if needed).

    You will likely want to reduce the resolution as the java applet will run in a firefox window :

    Code:
    vncserver -geometry 800x600 -depth 24 :1
    If you have a large monitor you may be able to increase the server resolution (-geometry 1280x1024).

    Note: 1024x768 is nice (client resolution @ 1280x1024)


    5. You can stop the server at any time with vncserver -kill

    Code:
    vncserver -kill :1
    6. Note: Additional servers ~ You can start additional servers with other defaults, for example :
    Code:
    vncserver -geometry 1024x768 -depth 24 :2
    THESE ADDITIONAL SERVERS WILL ALL USE THE SAME PASSWORD (unless you start them under an alternate user name).

    Client setup

    1. Enable the commercial repos as above.


    2. Install by any means sun-java6-jre and sun-java-6-plugin

    Code:
    sudo apt-get install sun-java6-jre and sun-java-6-plugin
    Note: You do not need a vnc (client) viewer for this how-to.


    3. Allow java : In Firefox Edit -> Preferences Select the "Content" tab, tic off the "Load images automatically" "Enable JavaScript" and "Enable Java" boxes.


    Connect

    Open Firefox, in the address bar type <vnc_server_ip> : 5801
    If needed, you can obtain the IP address of the server with a ping (see "Server" section above)

    For example:

    192.168.1.25:5801
    <name_of_dyndns_server>:5801
    The java applet will start automatically.

    If you use NoScript (or other java blockers) you will need to allow 192.168.1.25:5801 once the connection is established.

    Click the connect button.

    Note: If you reload the firefox window you will need to log in again.

    Screen shots :



    References :

    VNC Ubuntu wiki
    Last edited by bodhi.zazen; November 21st, 2007 at 04:33 PM. Reason: Fixed link
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  2. #2
    Join Date
    Mar 2006
    Beans
    Hidden!

    Re: HowTo: Remote Access Ubuntu using Firefox

    nice work bodhi.zazen
    No longer participating......

  3. #3
    Join Date
    Aug 2007
    Location
    Kansas City, MO
    Beans
    Hidden!
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: HowTo: Remote Access Ubuntu using Firefox

    Nice How-To.

    It got me thinking though that another HOW-TO that may be nice, using much of your HOW-TO as a base, is to explain to people how they can use VNC tunneled over SSH. Its a very basic change to your How-To, requiring only Putty instead of Firefox with some basic loopbacks. Even most corporate firewalls allow port 22 out, thus control over SSH is rather easy.

    I may still have the writeup of how to do it if you'd like me to send it to you.

  4. #4
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: HowTo: Remote Access Ubuntu using Firefox

    Quote Originally Posted by Jose Catre-Vandis View Post
    nice work bodhi.zazen
    Hey, thanks Jose Catre-Vandis

    I wrote this mainly because although it is described as a feature in tightvnc, I could not find a how-to anywhere.

    Quote Originally Posted by KCPokes View Post
    Nice How-To.

    It got me thinking though that another HOW-TO that may be nice, using much of your HOW-TO as a base, is to explain to people how they can use VNC tunneled over SSH. Its a very basic change to your How-To, requiring only Putty instead of Firefox with some basic loopbacks. Even most corporate firewalls allow port 22 out, thus control over SSH is rather easy.

    I may still have the writeup of how to do it if you'd like me to send it to you.
    KCPokes : There is such a document here :

    VNCOverSSH

    I have been adding to this document, and actually took some screen shots of cygwin, putty, and winscp I was going to add into this document.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  5. #5
    Join Date
    Aug 2007
    Location
    Kansas City, MO
    Beans
    Hidden!
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: HowTo: Remote Access Ubuntu using Firefox

    Quote Originally Posted by bodhi.zazen View Post
    KCPokes : There is such a document here :

    VNCOverSSH

    I have been adding to this document, and actually took some screen shots of cygwin, putty, and winscp I was going to add into this document.
    Excellent. Definitely a useful HOW-TO for a lot of people.

  6. #6
    Join Date
    May 2007
    Location
    Philadelphia
    Beans
    Hidden!
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: HowTo: Remote Access Ubuntu using Firefox

    If I were to screw something up in Ubuntu so that I couldn't boot/log on, would this allow me to access Ubuntu from Windows?

    I haven't tried this yet, but it looks like a great guide. I'll definitely be trying this.

  7. #7
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: HowTo: Remote Access Ubuntu using Firefox

    Quote Originally Posted by Yes View Post
    If I were to screw something up in Ubuntu so that I couldn't boot/log on, would this allow me to access Ubuntu from Windows?
    Well, if you can not boot Ubuntu, no you will not be able to gain access via this how-to.

    If you can boot, gut the gui fails, you may be able to log in this way (or with ssh). To use this how-to the vncserver would need to be active and they system must be in good enough shape to be running/accepting commands.

    I think though that you will need to fix your boot/log in porblem.

    I haven't tried this yet, but it looks like a great guide. I'll definitely be trying this.
    Enjoy
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  8. #8
    Join Date
    Jan 2007
    Beans
    4

    Re: HowTo: Remote Access Ubuntu using Firefox

    First, great How-to! This is EXACTLY what I wanted to do and worked great!
    Maybe this can help someone. I changed 2 things in my setup.
    1. The fonts section supplied did not work for me. I’m running Feisty (7.04). I added the following at the end of /etc/vnc.conf:

    $fontPath "unix/:7100" # local font server
    # if the local font server has problems, we can fall back on these
    $fontPath .= "/usr/share/X11/fonts/misc,";
    $fontPath .= "/usr/share/X11/fonts/cyrillic,";
    $fontPath .= "/usr/share/X11/fonts/100dpi/:unscaled,";
    $fontPath .= "/usr/share/X11/fonts/75dpi/:unscaled,";
    $fontPath .= "/usr/share/X11/fonts/Type1,";
    $fontPath .= "/usr/share/X11/fonts/CID,";
    $fontPath .= "/usr/share/X11/fonts/100dpi,";
    $fontPath .= "/usr/share/X11/fonts/75dpi,";
    # paths to defoma fonts
    $fontPath .= "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType?,";
    $fontPath .= "/var/lib/defoma/x-ttcidfont-conf.d/dirs/CID";

    2. For my KDE desktop I use the following ~/.vnc/xstartup
    ##!/bin/sh

    xrdb $HOME/.Xresources
    xsetroot -solid navy # Choose your color
    x-terminal-emulator -geometry 80x24+10+1- -ls -title "$VNCDESKTOP Desktop" &
    startkde &
    kicker 2> /dev/null &

  9. #9
    Join Date
    Aug 2007
    Beans
    64

    Re: HowTo: Remote Access Ubuntu using Firefox

    This tutorial is great and has worked in part for me.
    I can access the my box from on my own network from firefox but i cant get at it from the internet i get to the java appet loading but then i get a connection error...

    network error: could not connect to server: myserver:5901
    any ideas?
    Last edited by Warpedflash; September 24th, 2007 at 10:40 PM.

  10. #10
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: HowTo: Remote Access Ubuntu using Firefox

    Quote Originally Posted by Warpedflash View Post
    This tutorial is great and has worked in part for me.
    I can access the my box from on my own network from firefox but i cant get at it from the internet i get to the java appet loading but then i get a connection error...


    any ideas?
    You need to forward 5901 (as well as 5801)
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

Page 1 of 4 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •