Reddragon - Ubuntu: Difference between revisions

From miki
Jump to navigation Jump to search
 
(13 intermediate revisions by the same user not shown)
Line 159: Line 159:
*:'''mich'''
*:'''mich'''


=== Printer ===
=== Printer / CUPS shit===
* Go to http://localhost:631
* Go to http://localhost:631
* Set ''default policy'' to ''abort-job'' (was on ''retry-job'')
* Set ''default policy'' to ''abort-job'' (was on ''retry-job'')
** Go to ''Printers'' → ''Canon-MG5300-series'' → ''Administration'' → ''Set default options'' → ''Policies'' → ''Error Policy'' = '''abort-job'''
** Go to ''Printers'' → ''Canon-MG5300-series'' → ''Administration'' → ''Set default options'' → ''Policies'' → ''Error Policy'' = '''abort-job'''

* April 5, 2020
:* Still the same issue.
:* Set printer policy of all printer to <code>retry-this-job</code> ({{file|/etc/cups/printers.conf}})
:* In <code>mich</code> user crontab, added:
# m h dom mon dow command
@reboot sleep 15 && ~/bin/cups-cron-enable&
:* The script {{file|~/bin/cups-cron-enable}}:
<source lang=bash>
#! /bin/bash

BASE=$(basename "$0")
LOGDIR=~/.cache/$BASE
LOG=~/.cache/$BASE/$BASE.log

mkdir -p "$LOGDIR"
touch $LOG

cat > $LOGDIR/logrotate.conf << __END__
compress
$LOG {
rotate 5
weekly
}
__END__
logrotate -s $LOGDIR/logrotate.status $LOGDIR/logrotate.conf

check_all_printers()
{
lpstat -p | \
while read TAG PRINTER MORE; do
if [ "$TAG" = "printer" ]; then
if [[ "$MORE" =~ disabled ]]; then
echo -n "[$(date)] $PRINTER: disabled -- restarting"
cupsenable "$PRINTER" && echo "ok" || echo "FAILED"
fi
fi
done
}

while : ; do
check_all_printers
sleep 5
done >> $LOG
</source>


== Detailed Application Settings ==
== Detailed Application Settings ==
=== HDMI support ===
* Create a desktop shortcut launching <code>~/bin/xdisplay.sh hdmi</code>.

=== Screensaver ===
=== Screensaver ===
* <tt>gnome-screensaver</tt> does not work anymore. It simply show a black screen
* <tt>gnome-screensaver</tt> does not work anymore. It simply show a black screen
* Use <tt>xscreensaver</tt> instead, and select ''glslideshow'' for a slideshow.
* Use <tt>xscreensaver</tt> instead, and select ''glslideshow'' for a slideshow.
sudo apt-get remove gnome-screensaver
sudo apt-get remove gnome-screensaver
sudo apt-get install xscreensaver xscreensaver-data-extras xscreensaver-gl-extra
sudo apt-get install xscreensaver xscreensaver-data-extra xscreensaver-gl-extra
* {{red|UPDATE ISSUES}} &mdash; viewer used by glslideshow maintains a cache at <tt>~/tmp/.xscreensaver-getimage.cache</tt>. Delete that file when updating the set of images in the slideshow.
* {{red|UPDATE ISSUES}} &mdash; viewer used by glslideshow maintains a cache at <tt>~/tmp/.xscreensaver-getimage.cache</tt>. Delete that file when updating the set of images in the slideshow.


Line 208: Line 256:
=== Remote support ===
=== Remote support ===
;New method
;New method
We call '''remote''' the remote laptop (to which we will connect), and '''local''', the laptop we connect from.
We call '''remote''' the remote laptop to which we will connect, and '''local''' the laptop we connect from. '''server''' is the intermediate ssh server.
* On '''server''', add to {{file|.ssh/authorized_keys}}:
* '''remote''' must automatically start <code>autonoekeon.sh</code> at boot:
<source lang="text">
no-pty,no-X11-forwarding,permitopen="localhost:54895",command="/bin/echo do-not-send-commands" ssh-rsa PUBLIC_KEY_HERE username@remoteserver
</source>

* On '''remote''', start automatically <code>autonoekeon.sh</code> at boot:
<source lang=bash>
<source lang=bash>
#! /bin/bash
#! /bin/bash


autossh -M 0 -f -N -n -q -R 54895:localhost:22 noekeon
autossh -M 0 -f -N -n -q -R 54895:localhost:22 immie # or 'ovhi'
</source>
</source>
* On ''local'', setup a 2nd SSH forwarding link:
* On ''local'', setup a 2nd SSH forwarding link:
autossh -M 0 -f -N -n -q -L 22221:localhost:54895 noekeon
autossh -M 0 -f -N -n -q -L 22221:localhost:54895 ovhi

* On ''local'', connect and starts the vnc server on ''remote'':
This being done, one can either start an SSH-only session, or an SSH+VNC session:
ssh -p 22221 -L 5900:localhost:5900 -L 5631:localhost:631 mich@localhost # if needed, add -L 5901:localhost:5901
* On ''local'', to start an SSH session only:
# export DISPLAY=:0
ssh -p 22221 mich@localhost
# xhost +
* On ''local'', to start an SSH and VNC session:
#sudo x11vnc -safer -localhost -nopw -once -auth /var/lib/gdm/:0.Xauth -display :0
# SSH connect to remote + fwd some vnc ports
ssh -p 22221 -L 5900:localhost:5900 -L 5631:localhost:631 -L 5901:localhost:5901 mich@localhost
# Old method:
# export DISPLAY=:0
# xhost +
# sudo x11vnc -safer -localhost -nopw -once -auth /var/lib/gdm/:0.Xauth -display :0
x11vnc -safer -localhost -nopw -once -tightfilexfer -auth ~/.Xauthority -display :0
x11vnc -safer -localhost -nopw -once -tightfilexfer -auth ~/.Xauthority -display :0
* Still on ''local'', starts the vnc viewer:
* In a separate terminal on ''local'', starts the vnc viewer:
#vncviewer localhost:0
#vncviewer localhost:0
xtightvncviewer -compresslevel 0 -bgr233 -quality 0 localhost:0
xtightvncviewer -compresslevel 0 -bgr233 -quality 0 localhost:0
* CUPS administration on ''remote'' is also available via <code>http://localhost:5631</code>
* CUPS administration on ''remote'' is also available via <code>http://localhost:5631</code>

;'''{{green|To try}}''' &mdash; x11vnc client-side caching:
<pre>
******************************************************************************
Have you tried the x11vnc '-ncache' VNC client-side pixel caching feature yet?

The scheme stores pixel data offscreen on the VNC viewer side for faster
retrieval. It should work with any VNC viewer. Try it by running:

x11vnc -ncache 10 ...

One can also add -ncache_cr for smooth 'copyrect' window motion.
More info: http://www.karlrunge.com/x11vnc/faq.html#faq-client-caching
</pre>

;'''{{red|old solution}}''' &mdash; Troubleshooting on scarlet box
;'''{{red|old solution}}''' &mdash; Troubleshooting on scarlet box
* Open a browser, and go to ''local.gateway''. Go to ''LAN servers''. Check that port ''12322'' is re-routed to server's port 22
* Open a browser, and go to ''local.gateway''. Go to ''LAN servers''. Check that port ''12322'' is re-routed to server's port 22
Line 368: Line 441:
</source>
</source>


== To Do / Issues ==
== To Do ==
=== opengl / hdmi / optimus issue ===
=== Issues ===
See [[Common Issues]].
<ul>
<li> '''{{red|Issue}}''' — No OpenGL support with nvidia. Check the links [https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers/+bug/810647], [http://ubuntuforums.org/showthread.php?t=1125400]. This is needed for ''XBMC''. See [http://wiki.xbmc.org/index.php?title=XBMC_for_Linux_specific_FAQ#Graphic.2Fvideo_issues this page] to test availability of OpenGL:</li>
<source lang="bash">
glxinfo | grep -i direct
# The result should be:
# direct rendering: Yes
</source>
Some useful commands:
<source lang=bash>
# Should display which card is active and which driver is in use
# (The line 'driver=nvidia' does not appear though for RedDragon
lshw -c display | grep driver
# configuration: driver=nvidia latency=0
# configuration: driver=i915 latency=0

# Display information on the nvidia card
# (from https://github.com/Bumblebee-Project/Bumblebee/issues/21)
/usr/lib/nvidia-current/bin/nvidia-xconfig --query-gpu-info --nvidia-cfg-path=/usr/lib/nvidia-current
</source>
Potential solutions:
* [https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers/+bug/807209 Lost glx after first upgrade from oneiric alpha 2 install (bug 807209)]
* [http://www.ivegotavirus.com/blog/2011/11/06/how-to-get-optimus-working-on-ubuntu-11-10-oneiric/ How To Get Optimus Working On Ubuntu 11.10 (Oneiric)]
* Install [http://bumblebee-project.org/ Bumblebee]
* Report information to [http://comments.gmane.org/gmane.comp.freedesktop.xorg.nouveau/9183 Nouveau Devs]
The bug is actually due to lack of support of new [http://www.nvidia.com/object/optimus_technology.html NVidia's Optimus Technology]:
<source lang=bash>
sudo apt-get remove nvidia-common nvidia-current nvidia-current-updates nvidia-settings nvidia-settings-updates
</source>
'''Some links to look at''':
*https://github.com/Bumblebee-Project/Bumblebee/wiki/Troubleshooting
from Googling "bumblebee external monitor hdmi":
*http://askubuntu.com/questions/103564/external-displays-with-bumblebee
*http://askubuntu.com/questions/113886/trying-to-use-an-external-monitor-with-bumblebee-geforce-gt-525m
*https://github.com/Bumblebee-Project/Bumblebee/issues/106
*https://github.com/Bumblebee-Project/Bumblebee-old/issues/40
*https://github.com/Bumblebee-Project/Bumblebee/issues/72
*http://zachstechnotes.blogspot.be/2012/04/post-title.html

;Since upgrade to Ubuntu Trusty Tahr 14.04 LTS
* HDMI still does not work out of the box
* Install {{deb|nvidia-331-updates}}
* Install bumblebee [https://wiki.ubuntu.com/Bumblebee#Installation]
<source lang=bash>
sudo add-apt-repository ppa:bumblebee/stable
sudo apt-get update
sudo apt-get install virtualgl # for glxspheres64
sudo apt-get install bumblebee bumblebee-nvidia primus linux-headers-generic
</source>
* Fix bug when starting see [http://www.webupd8.org/2013/10/fix-bumblebee-libturbojpegso-issue-in.html]:
sudo ln -s /usr/lib/x86_64-linux-gnu/libturbojpeg.so.0 /usr/lib/x86_64-linux-gnu/libturbojpeg.so
* We get different benchmark when using <code>primusrun</code> and when using <code>optirun</code>:
optirun glxspheres64 # 150.254538 frames/sec - 157.995651 Mpixels/sec
primusrun glxspheres64 # 60.295114 frames/sec - 63.401518 Mpixels/sec
:maybe this is due to frame sync when using <code>primusrun</code>? (60Hz)
* <code>bbswtich</code> is a bumblebee module that can be used to switch on / off the nvidia card. When running, there should be a file {{file|/proc/acpi/bbswitch}}:
cat /proc/acpi/bbswitch
0000:01:00.0 ON
:If not available, load the module manually:
sudo modprobe bbswitch
dmesg | tail -n 1
</ul>

=== other issues ===

<ul>
<li> '''Issue''' — External headphone (jack) does not work</li> (see bug [https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/978880 978880])
* '''Broken solution''' &mdash; See [http://pricklytech.wordpress.com/2012/05/26/ubuntu-12-04-dell-vostro-3750-no-sound-when-headphones-are-plugged-in/]. Edit <tt>/usr/share/pulseaudio/alsa-mixer/paths/analog-output-headphones.conf</tt> (and similar <tt>...-2.conf</tt> files if any) (more links [https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/978880], [http://askubuntu.com/questions/132440/headphone-jack-not-working], [http://playingwithsid.blogspot.be/2010/06/headphone-jack-sense-problem-in-ubuntu.html]). Change the lines:
<source lang=diff>
[Element Speaker]
-switch = off
+switch = on
-volume = off
+volume = ignore
</source>
:{{red|Update}} &mdash; this does not work. Settings are reverted after ''pulseaudio'' update. Moreover the bass speaker is not correctly handled.
* {{green|'''Solved'''}} The solution is to install the latest Realtek codec from [http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PNid=24&PFid=24&Level=4&Conn=3&DownTypeID=3&GetDown=false#High%20Definition%20Audio%20Codecs here], v5.18 (more information [http://doc.ubuntu-fr.org/dell_vostro_1014], [http://doc.ubuntu-fr.org/audio_intel_hda], [https://help.ubuntu.com/community/HdaIntelSoundHowto], [http://lxr.linux.no/#linux+v3.2.19/Documentation/sound/alsa/HD-Audio-Models.txt]). To install, just un-tar and run given <code>./install</code> script:
<source lang=bash>
tar -jxvzf ...
cd ...
vi install # install script has a bug, fetch exec at wrong place after untar
sudo ./install
</source>
<li> '''{{red|To Do}}''' — Setup BEH (backend error handler) for CUPS</li>
<li> '''Issue''' — Cannot read movies from DVD-RW</li>
* '''{{green|Solved}}''' &mdash; Require patch on {{deb|udisks}} (see [[Linux Admin#Udisks|Udisks]]).
* '''{{blue|Ubuntu 14.04 LTS}}''' &mdash; Require patch on '''{{deb|udisks2}}''' (see [[Linux Admin#Udisks|Udisks]]).
<li> '''{{red|Issue}}''' — Sometimes keyboard in '''US''' layout</li>
* Temp fix: Add <code>bin/setkbmap.sh</code> and run it at startup:
#! /bin/bash
setxkbmap be
<li> '''{{red|Issue}}''' — Flash instability</li>
* Temp fix: Uninstall all '''nvidia''' drivers
* Temp fix: Uninstall '''flashplugin-installer'''
* Temp fix: Install dansguardian & privoxy to prevent access to underground/unstable sites
** Setup local network proxy: localhost:8080
** Idem in firefox
** ! for thunderbird, select '''no proxy''' (if proxy configured in system parameters &rarr; network... incredible but true [http://forums.mozillazine.org/viewtopic.php?f=31&t=2449619])

;Other issues after upgrade to Trusty Tahr
* System still thinks the DVD is present after pressing the eject button. One must select ''eject DVD'' in the launcher.
* DVD-RW still un-readable (but now package ''udisks2'')


=== To Do ===
</ul>
None.

Latest revision as of 16:05, 5 April 2020

Introduction

This is the configuration page for the Ubuntu partition on RedDragon.

Configuration Files

All configuration files can be found here.

Repositories

Installed Applications

Common Essential:
[2011-11-16] Opera (opera) [2011-11-16] v 11.00.1156
[2011-11-16] etckeeper (etckeeper) Configured to use git as SCM
[2011-11-16] GIT (git git-gui gitk git-doc)
[2011-11-16] Google Chrome (chromium-browser)
[2011-11-16] Midnight Commander (mc) See reference page. Use vi as standard viewer/editor. Installed version from mc official repository to fix file highlighting issue.
[2011-11-16] Vim (vim, exuberant-ctags, vim-gnome) including GVim to enable support of X clipboard
[2011-11-16] Ruby (ruby) ... for Vim plug-in snipMate.vim
[2011-11-16] Vim/Cscope (cscope)
[2011-11-16] Samba (smbclient smbfs)
[2011-11-16] NFS Server (nfs-kernel-server nfs-common portmap) See NFS for more details; Created entries in /etc/exports.
[2011-11-16] AutoFS (autofs) See local config
[2011-11-16] KeePassX (keepassx)
[2011-11-16] apt-file (apt-file)
[2011-11-16] SSH (ssh) Local settings
[2011-11-16] Thunderbird (thunderbird)
[2011-11-16] Meld (meld) Diff tool
[2011-11-16] Color Diff (colordiff)
[2011-11-16] p7zip (p7zip-full p7zip-rar)
[2011-11-16] dlocate (dlocate)
[2011-11-16] MS Truetype core fonts (ttf-msttcorefonts-installer)
[2011-11-16] Ubuntu restricted extras (ubuntu-restricted-extras) shall install automatically libdvdread4
[2011-01-18] libdvdcss2 Installed via sudo /usr/share/doc/libdvdread4/install-css.sh (see also [1])
[2011-11-16] Qiv (qiv)
[2011-11-16] gThumb (gthumb)
[2011-11-16] GPG Agent (gnupg-agent) Added use-agent at end of ~/.gnupg/gpg.conf
[2011-11-16] Rename utils (renameutils)
[2011-11-16] Wine (wine) See Wine page
[2011-11-16] Gnome Terminator (terminator) See Gnome Terminator
[2011-11-16] Flash Plugin 10 (flashplugin-installer) First need to enable Ubuntu partner repository (deb http://archive.canonical.com/ubuntu lucid partner). Next
sudo aptitude autoremove "flashplugin-*"
sudo aptitude install flashplugin-installer
[2011-11-16] MPlayer (mplayer mplayer-doc mplayer-fonts)
[2011-11-16] Quicktime plugin (gnome-mplayer,gecko-mediaplayer) To play Quicktime content in Opera, Firefox
[2011-11-16] Gimp (gimp)
[2011-11-16] Graphical Disk Map (gdmap)
[2011-11-16] gparted (gparted)
Dist-upgrade to Precise Pangolin
[2012-04-18] Bumblebee (bumblebee bumblebee-nvidia)
[2013-05-28] mini upnp (miniupnpc) For remote support script
[2013-05-28] vnc server (vnc4server) For remote support script
Local applications:
[2011-11-16] GNU Go (gnugo)
[2011-11-16] Various Go games (qgo uligo)
[2011-11-16] Quarry (quarry) Board games Go, Amazons, and Reversi
[2011-11-16] XBMC (xbmc xbmc-standalone) See local page
[2011-11-16] fdupes (fdupes)
[2011-11-16] PGP (pgpgpg)
[2011-11-16] Synergy (synergy) [2011-03-04] v1.4.5! See local settings.
[2011-11-16] Perl Audio Converter (pacpl)
[2011-11-16] PowerTop (powertop)
[2011-11-16] Gnome Tweak Tool (gnome-tweak-tool) To change default font size...
[2011-11-16] XScreensaver (xscreensaver xscreensaver-gl-extra xscreensaver-data-extra) First remove gnome screensaver (sudo apt-get remove gnome-screensaver). Then set the screensaver as startup app (xscreensaver -nosplash). Select glslideshow. [2], [3], [4]
Dist-upgrade to Precise Pangolin



Un-installed applications (by uninstall date):

[YYYY-MM-DD] Application (package) [YYYY-MM-DD] uninstalled (reason)

Simple Settings

  • [2009-10-19] - Enabled proprietary video device driver NVIDIA (version 280).
  • [2013-05-18] - Enable audio head-phone (see [5]). Edit file /usr/share/pulseaudio/alsa-mixer/paths/analog-output-headphones.conf as follows:
[Element Speaker]
switch = on
volume = ignore
  • Printer — add Canon network printer (select IPP network printer via DNS-SD for protocol).
    • Set Color Model to CMYK

Detailed System Settings

1st install

  • INSTALL LOG

File System

  • To be completed

Network

  • To be completed

Preferences

  • To be completed

Users

  • Added to group users (for write access to mnemosyne):
    mich

Printer / CUPS shit

  • Go to http://localhost:631
  • Set default policy to abort-job (was on retry-job)
    • Go to PrintersCanon-MG5300-seriesAdministrationSet default optionsPoliciesError Policy = abort-job
  • April 5, 2020
  • Still the same issue.
  • Set printer policy of all printer to retry-this-job (/etc/cups/printers.conf)
  • In mich user crontab, added:
# m h  dom mon dow   command
@reboot   sleep 15 && ~/bin/cups-cron-enable&
  • The script ~/bin/cups-cron-enable:
#! /bin/bash

BASE=$(basename "$0")
LOGDIR=~/.cache/$BASE
LOG=~/.cache/$BASE/$BASE.log

mkdir -p "$LOGDIR"
touch $LOG

cat > $LOGDIR/logrotate.conf << __END__
compress
$LOG {
    rotate 5
    weekly
}
__END__
logrotate -s $LOGDIR/logrotate.status $LOGDIR/logrotate.conf

check_all_printers()
{
    lpstat -p | \
    while read TAG PRINTER MORE; do
        if [ "$TAG" = "printer" ]; then
            if [[ "$MORE" =~ disabled ]]; then
                echo -n "[$(date)] $PRINTER: disabled -- restarting"
                cupsenable "$PRINTER" && echo "ok" || echo "FAILED"
            fi
        fi
    done
}

while : ; do
    check_all_printers
    sleep 5
done >> $LOG

Detailed Application Settings

HDMI support

  • Create a desktop shortcut launching ~/bin/xdisplay.sh hdmi.

Screensaver

  • gnome-screensaver does not work anymore. It simply show a black screen
  • Use xscreensaver instead, and select glslideshow for a slideshow.
 sudo apt-get remove gnome-screensaver
 sudo apt-get install xscreensaver xscreensaver-data-extra xscreensaver-gl-extra
  • UPDATE ISSUES — viewer used by glslideshow maintains a cache at ~/tmp/.xscreensaver-getimage.cache. Delete that file when updating the set of images in the slideshow.

Using xscreensaver without OpenGL

  • Package chbg does not exist anymore.
  • I could build package xv, but it does nothing under xscreensaver.
  • Use package qiv. Add the following line in .xscreensaver:
  qiv -s -r -S -d 10  -f -u -l -t -i      \
          $HOME/Slideshow               \n\
  • Select qiv as screensaver.

Apparently qiv does not work well with sub-folders. I use the following script (autoln):

#! /bin/bash
#
# Usage: autoln /path/to/file /path/to/second/file [...]
#
#        will create the following symbolic links:
#
#        _path_to_file         --> /path/to/file
#        _path_to_second_file  --> /path/to/second/file

while [ -n "$1" ]; do
    target="$1"
    symlink=${target//\//_}
    ln -ns "$target" "$symlink"
    shift
done

In the command line:

find -L /home/mich/Slideshow -type f -print0  | xargs -0 autoln

Remote support

New method

We call remote the remote laptop to which we will connect, and local the laptop we connect from. server is the intermediate ssh server.

  • On server, add to .ssh/authorized_keys:
no-pty,no-X11-forwarding,permitopen="localhost:54895",command="/bin/echo do-not-send-commands" ssh-rsa PUBLIC_KEY_HERE username@remoteserver
  • On remote, start automatically autonoekeon.sh at boot:
#! /bin/bash

autossh -M 0 -f -N -n -q -R 54895:localhost:22 immie    # or 'ovhi'
  • On local, setup a 2nd SSH forwarding link:
autossh -M 0 -f -N -n -q -L 22221:localhost:54895 ovhi

This being done, one can either start an SSH-only session, or an SSH+VNC session:

  • On local, to start an SSH session only:
ssh -p 22221 mich@localhost
  • On local, to start an SSH and VNC session:
# SSH connect to remote + fwd some vnc ports
ssh -p 22221 -L 5900:localhost:5900 -L 5631:localhost:631 -L 5901:localhost:5901 mich@localhost          
# Old method:
#   export DISPLAY=:0
#   xhost +
#   sudo x11vnc -safer -localhost -nopw -once -auth /var/lib/gdm/:0.Xauth -display :0
x11vnc -safer -localhost -nopw -once -tightfilexfer -auth ~/.Xauthority -display :0
  • In a separate terminal on local, starts the vnc viewer:
#vncviewer localhost:0
xtightvncviewer -compresslevel 0 -bgr233 -quality 0 localhost:0
To try — x11vnc client-side caching
******************************************************************************
Have you tried the x11vnc '-ncache' VNC client-side pixel caching feature yet?

The scheme stores pixel data offscreen on the VNC viewer side for faster
retrieval.  It should work with any VNC viewer.  Try it by running:

    x11vnc -ncache 10 ...

One can also add -ncache_cr for smooth 'copyrect' window motion.
More info: http://www.karlrunge.com/x11vnc/faq.html#faq-client-caching
old solution — Troubleshooting on scarlet box
  • Open a browser, and go to local.gateway. Go to LAN servers. Check that port 12322 is re-routed to server's port 22
old solution — How to connect

(note: previous config used to send an e-mail to michael.peeters@noekeon.org with instructions, but this does not work anymore. Now it creates a gpg file on noekeon.org)

  • Download gpg file, then view content for instructions:
scpn @/mip.txt.gpg .
gpg -d mip.txt.gpg >mip.txt


old solution — Configuration on the server
  • Disable strict host key checking for noekeon (to allow ssh connection even if host key changed):
Host ftp.noekeon.org   noekeon
     User                    daemenj
     HostName                ftp.noekeon.org
     StrictHostKeyChecking   no
  • autonoekeon.sh is run automatically at logon:
#! /bin/bash

autossh -M 0 -f -N -n -q -R 54895:localhost:22 noekeon
To connect, first setup port forwarding, then connect via localhost:
autossh -M 0 -f -N -n -q -L 22221:localhost:54895 noekeon
ssh mike@localhost -p 22221
  • Port forwarding also allows to connect to router and cups server:
autossh -M 0 -f -N -n -q -L 8080:192.168.1.1:80 -p 22221 mich@localhost   # Access remote router      via localhost:8080
autossh -M 0 -f -N -n -q -L 8081:localhost:631 -p 22221 mich@localhost    # Access remote cups server via localhost:8081
  • Script on desktop to setup vnc remote (vnctunnelnoekeon):
#! /bin/bash

# Save current stdout / stderr
exec 3>&1
exec 4>&2

# Redirect stdout / stderr
exec > >(tee /tmp/stdout.tmp)
exec 2> >(tee /tmp/stderr.tmp >&2)

# Deleting current .ssh/known_hosts
echo "Deleting current .ssh/known_hosts"
rm .ssh/known_hosts

# Open a vncserver
echo "Opening a virtual desktop for remote desktop sharing..."
vnc4server :1 -geometry 1440x900 -depth 8 -rfbport 5901

# TRAP EXIT --> Will remove port forwarding and kill the VNC server
trap "upnpc -d 12322 TCP; vnc4server -kill :1; rm /tmp/vnctunnelnoekeon-tail-f.tmp" EXIT

# Tunnel the VNC + local SSH Server connection through noekeon ssh
# ... SSH tunnel will remain open for 5min after which it will be automatically closed if no connection is made
ssh -f -n -R12301:localhost:5901 -R12322:localhost:22 noekeon sleep 300
# Wait a bit so that error message don't mess up my text below...
sleep 2

echo "################################################################################"
IPLOCAL=$(getlocalip.sh)
echo "Local IP address: $IPLOCAL"
IPPUBLIC=$(getpublicip.sh)
echo "Public IP address: $IPPUBLIC"
echo "################################################################################"
echo "Opening port 12322 on UPNP:"
upnpc -a "$IPLOCAL" 22 12322 TCP | tail -n 1
echo "################################################################################"

#Stop tee redirection
exec >&3
exec 2>&4

#Mail the current session to me
MAILSERVER=smtp.scarlet.be
FROM=michel.roch@scarlet.be
TO=michael.peeters@noekeon.org
echo "Sending mail to $TO..."
exec 5<>/dev/tcp/${MAILSERVER}/25
cat <&5 >/dev/null &
sleep 1
echo -e "HELO dummy.domain" >&5
sleep 1
echo -e "MAIL FROM: $FROM" >&5
sleep 1
echo -e "RCPT TO: $TO" >&5
sleep 1
echo -e "DATA" >&5
sleep 1
echo -e "subject: IP Addresses" >&5
echo -e "" >&5
echo -e "LOCAL IP Address: $IPLOCAL" >&5
echo -e "PUBLIC IP Address: $IPPUBLIC" >&5
echo -e >&5
echo -e "Connect with 'ssh -p 12322 username@$IPPUBLIC'" >&5
echo -e >&5
echo -e >&5
echo -e "Content of stdout:" >&5
echo -e "---------------------------------------------------------------------" >&5
cat /tmp/stdout.tmp >&5
echo -e "---------------------------------------------------------------------" >&5
echo -e >&5
echo -e "Content of stderr:" >&5
echo -e "---------------------------------------------------------------------" >&5
cat /tmp/stderr.tmp >&5
echo -e "---------------------------------------------------------------------" >&5
echo -e "." >&5
sleep 1
echo -e "QUIT" >&5
sleep 1
echo '... mail sent (hopefully)!'
echo

# Cleaning...
rm /tmp/stdout.tmp
rm /tmp/stderr.tmp

# kill it when the user press a key
echo "========================================================================"
# tail file to duplicate edit session. Eg:
# 1. Connect to $IPPUBLIC
# 2. tee stderr
#    exec 2> >(tee /tmp/vnctunnelnoekeon-tail-f.tmp >&2)
# 3. Redirect stdout
#    exec >&2
# 4. From now, current terminal will duplicate login terminal
touch /tmp/vnctunnelnoekeon-tail-f.tmp
tail -f /tmp/vnctunnelnoekeon-tail-f.tmp &
read -p "Press ENTER to close the desktop sharing session..." ignore
# No need to kill VNC / UPNP port forwarding, will be done on EXIT signal trap
# ssh will exit automatically

To Do

Issues

See Common Issues.

To Do

None.