Yes you can.
Today I needed to test an openconnect VPN connection while inside a LAN. At this site my desktop is Windows but I needed to check connectivity from outside for Linux users, using the openconnect and NetworkManager-openconnect packages.
Let's see, I could plug my smartphone into the USB port of the desktop, forward the USB connection to Fedora 16 inside VirtualBox and I should be able to connect to usb0 and I would have a WAN connection from outside. Right?
To cut to the chase, it just works.
In the VirtualBox, make sure USB forwarding is enabled in the VM settings. Plug in the smartphone and turn on USB tethering. Ignore Windows suggestions to install hardware drivers for your smartphone. When the VM is running, there will be a USB icon on the bottom bar. Choose the USB device that is your smartphone. Windows will suggest installing a VirtualBox USB driver. Do that. On Linux a usb0 device should appear in the network manager and after disabling the eth0 device which forwards to Windows, you can connect to it. You should then get a DHCP lease from your smartphone and be connected to the outside world.
It seems you have to install the VirtualBox USB driver every time the VM is started, not sure why.
This should work on other distros. For example I know openconnect works on Debian and Ubuntu. It should also work for other VPN technologies, such as openvpn. The USB network driver is called cdc-ether, by the way.
Thursday, 29 March 2012
Sunday, 11 March 2012
Two gotchas with Postfix, Dovecot, Amavis and Clamav on Debian Squeeze
1. The first problem was when this error appeared in /var/log/mail.log:
Mar 10 16:56:39 mailhost amavis[2877]: (02877-01) (!)ClamAV-clamd av-scanner FAILED: CODE(0x358cef8) unexpected , output="/var/lib/amavis/tmp/amavis-20120310T165639-02877/parts: lstat() failed: Permission denied. ERROR\n" at (eval 103) line 594.
The problem is that clamav requires access to files created by amavis. We fix this by putting amavis and clamav in each other's group.
usermod -a -G clamav amavis
/var/spool/postfix/private/auth-client
Then in /etc/postfix/main.cf we specify the path to the named pipe with:
smtpd_sasl_path = private/auth-client
It's a path relative to $queue_directory which is /var/spool/postfix.
Mar 10 16:56:39 mailhost amavis[2877]: (02877-01) (!)ClamAV-clamd av-scanner FAILED: CODE(0x358cef8) unexpected , output="/var/lib/amavis/tmp/amavis-20120310T165639-02877/parts: lstat() failed: Permission denied. ERROR\n" at (eval 103) line 594.
The problem is that clamav requires access to files created by amavis. We fix this by putting amavis and clamav in each other's group.
usermod -a -G clamav amavis
usermod -a -G amavis clamav
Then restart amavis and clamav-daemon.
2. The second problem was when postfix could not authenticate incoming SMTP connections by chaining to dovecot's auth process, resulting in this message in /var/log/mail.log:
Mar 10 18:28:14 mailhost postfix/smtpd[7217]: warning: SASL: Connect to /var/run/dovecot/auth-client failed: No such file or directory
The problem is that postfix runs chrooted by default in Squeeze and this named pipe is outside of the chroot tree. To fix it we tell dovecot to use this path instead:
/var/spool/postfix/private/auth-client
Then in /etc/postfix/main.cf we specify the path to the named pipe with:
smtpd_sasl_path = private/auth-client
It's a path relative to $queue_directory which is /var/spool/postfix.
Thursday, 9 February 2012
Selecting a text region on Android 2.3+
I often need to select a region of text on my smartphone, to delete, or to copy to the clipboard. What to do when you have a small screen and few input devices, unlike a desktop? I figured it out.
Touch and hold the screen until the popup menu appears. Choose Select Word or Select All. Which one you use depends on how much you want to include or exclude. You will get two "paddles" surrounding the selection. Drag them to surround the region you want, then hit backspace to delete, or tap the screen to copy to clipboard. Depending on the app, there might be other options accessible from the menu to check the text in dictionary, etc.
This is actually explained in detail in this Android guide. I wish I had found that guide when I was first looking.
Hope this helps.
Touch and hold the screen until the popup menu appears. Choose Select Word or Select All. Which one you use depends on how much you want to include or exclude. You will get two "paddles" surrounding the selection. Drag them to surround the region you want, then hit backspace to delete, or tap the screen to copy to clipboard. Depending on the app, there might be other options accessible from the menu to check the text in dictionary, etc.
This is actually explained in detail in this Android guide. I wish I had found that guide when I was first looking.
Hope this helps.
Friday, 2 September 2011
Importing a whole bunch of MH mail files into dovecot
I had some old MH mail that I recovered from backup that I wanted to import into my dovecot server. This is personal mail so I will only describe how to do it for my account. The MH file paths were of the form:
from/alice/1
from/alice/2
from/bob/1
from/carol/1
I wanted to import the alice mail into the logical dovecot mail folder Archives/from/alice and similarly for the others. (Archives is a Thunderbird standard.) In my dovecot setup however, the corresponding maildir directory is ~/Mail/.Archives.from.alice
First I shut down Thunderbird so that it wouldn't interfere during the second step later. This script does the job (backslash continuation inserted for clarity):
for d in from/*
do
for f in $d/[0-9]*
do
/usr/lib/dovecot/deliver -s -m \
Archives.${d/\//.} -p $f
done
done
See the documentation of deliver for the meanings of the -s -m and -p options.
You can track the progress of the import by following the syslog file for mail. Any failed imports go into INBOX.
This second step is not required, but I am obsessive. I wanted each imported file to have the same timestamp as the old one. This script uses findup from the fslint toolkit to collect the duplicates (backslash continuation inserted for clarity):
/usr/local/src/fslint-2.42/fslint/findup \
from ~/Mail/.Archives.*.* > /tmp/dups
This generates pairs of duplicates in /tmp/dups separated by a blank line. This script then applies the old timestamp to each new file.
while read a
do
read b
touch -r $a $b
read c
done < /tmp/dups
I still have to figure out how to mark all the old mail read from the CLI. I just went into Thunderbird and marked each folder read. If you have a good solution, please do comment.
from/alice/1
from/alice/2
from/bob/1
from/carol/1
I wanted to import the alice mail into the logical dovecot mail folder Archives/from/alice and similarly for the others. (Archives is a Thunderbird standard.) In my dovecot setup however, the corresponding maildir directory is ~/Mail/.Archives.from.alice
First I shut down Thunderbird so that it wouldn't interfere during the second step later. This script does the job (backslash continuation inserted for clarity):
for d in from/*
do
for f in $d/[0-9]*
do
/usr/lib/dovecot/deliver -s -m \
Archives.${d/\//.} -p $f
done
done
See the documentation of deliver for the meanings of the -s -m and -p options.
You can track the progress of the import by following the syslog file for mail. Any failed imports go into INBOX.
This second step is not required, but I am obsessive. I wanted each imported file to have the same timestamp as the old one. This script uses findup from the fslint toolkit to collect the duplicates (backslash continuation inserted for clarity):
/usr/local/src/fslint-2.42/fslint/findup \
from ~/Mail/.Archives.*.* > /tmp/dups
This generates pairs of duplicates in /tmp/dups separated by a blank line. This script then applies the old timestamp to each new file.
while read a
do
read b
touch -r $a $b
read c
done < /tmp/dups
I still have to figure out how to mark all the old mail read from the CLI. I just went into Thunderbird and marked each folder read. If you have a good solution, please do comment.
Monday, 2 May 2011
Truth is stranger than fiction, or, The Internet rocks
A friend of mine gave me a dead Dell Latitude D600 to look over in the hope that I could revive it. The symptom was that it wouldn't power up.
Well it did power up for me on my bench and I proceeded to update the software and clean the disk. Then the bug struck: pressing the power button would only cause the LEDs to flash rapidly for a few seconds and the machine would sink into inactivity again.
A dead clock battery can cause this because the CPU has no source of timer events for the BIOS code. Fortunately in this model, the clock cells are very accessible. I measured the three of them and their voltage was well above the 7.2V required. So that wasn't the problem.
So I did a search on the Internet and found this page on FixYa. The top solution was to depress F7 and F8 while booting. I was skeptical but it was simple to try. Lo and behold, the machine fired up. Apparently this model experiences a lot of contact problems with the BIOS chip which is just underneath F7 and F8.
The owner told me that a repair shop had assured him that the machine was beyond repair. Maybe they need to be told about this thing called the Internet.
Well it did power up for me on my bench and I proceeded to update the software and clean the disk. Then the bug struck: pressing the power button would only cause the LEDs to flash rapidly for a few seconds and the machine would sink into inactivity again.
A dead clock battery can cause this because the CPU has no source of timer events for the BIOS code. Fortunately in this model, the clock cells are very accessible. I measured the three of them and their voltage was well above the 7.2V required. So that wasn't the problem.
So I did a search on the Internet and found this page on FixYa. The top solution was to depress F7 and F8 while booting. I was skeptical but it was simple to try. Lo and behold, the machine fired up. Apparently this model experiences a lot of contact problems with the BIOS chip which is just underneath F7 and F8.
The owner told me that a repair shop had assured him that the machine was beyond repair. Maybe they need to be told about this thing called the Internet.
Saturday, 23 April 2011
How to access CIFS shares from a user account on Ubuntu Lucid
A friend of mine has a Samba server which I set up for him. His problem was that although he could see the shares from the file browser using Connect to Server, they were not accessible from Thunderbird for attaching to emails, etc. and he had to do a copy to a local directory first.
I did a search and found tips involving setting up fstab. This was not satisfactory because the machine was a notebook and the server would not be accessible while on the road. Tips involving autofs and automount were also not satisfactory because of the complicated setup.
I figured that since the file browser could see the share, it must be mounted somewhere. The output of mount showed that it was mounted on $HOME/.gvfs. The problem is that theThunderbird file selector does not display dotfiles. Other programs may have a similar restriction. My solution was this:
ln -s .gvfs GVFS
I then instructed him to look for his share under GVFS. Actually Thunderbird can navigate to dotfiles, you have to click on the Type a file name icon at the top left and type in .gvfs, but I figured that this was much easier for the user.
If you make a bookmark in the file browser and also tell it to remember the credentials for the connection, it should be one-click to mount. I think this should work for the other types of mounts that the file browser can do, e.g. FTP.
I did a search and found tips involving setting up fstab. This was not satisfactory because the machine was a notebook and the server would not be accessible while on the road. Tips involving autofs and automount were also not satisfactory because of the complicated setup.
I figured that since the file browser could see the share, it must be mounted somewhere. The output of mount showed that it was mounted on $HOME/.gvfs. The problem is that theThunderbird file selector does not display dotfiles. Other programs may have a similar restriction. My solution was this:
ln -s .gvfs GVFS
I then instructed him to look for his share under GVFS. Actually Thunderbird can navigate to dotfiles, you have to click on the Type a file name icon at the top left and type in .gvfs, but I figured that this was much easier for the user.
If you make a bookmark in the file browser and also tell it to remember the credentials for the connection, it should be one-click to mount. I think this should work for the other types of mounts that the file browser can do, e.g. FTP.
Labels:
attachments,
CIFS,
file browser,
GNOME,
Samba,
shares,
ubuntu,
Windows
Saturday, 19 February 2011
Subscribe to:
Posts (Atom)
