My words on free/open source software

Tuesday, August 14, 2007

Gmail, Fetchmail and Sendmail on UNIX/Linux

Linux Home Automation hosts a good article, Linux, Sendmail and Gmail.com on how to configure sendmail to work with Gmail. My config is a bit simpler than his (tested on Fedora Core 4, 6, Red Hat Enterprise Linux 5, CentOS 5, should work on most modern Linux distros).

My fetchmail run control file (.fetchmailrc):
 
set syslog
poll pop.gmail.com with proto POP3 and options no dns
user 'abc@gmail.com'
pass "WriteYourPasswordHere"
ssl


Modification to sendmail's mc file (/etc/mail/sendmail.mc):

define(`SMART_HOST',`smtp.gmail.com')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl


To generate the authinfo file used above, refer to
Linux, Sendmail and Gmail.com. It's very simple and you can done it within 3 minutes.

Monday, July 23, 2007

Install Amarok on CentOS5/RHEL5

Now I prefer to build amarok by using SRPM from latest Fedora on CentOS/RHEL. Though I think the following method should still work, it's not the best solution. The first problem is that Fedora 6 is no longer supported and you get no security patches, the second is that some packages from Fedora 6 Extra repo conflicts with similar packages from RPMForge, which is a must for nearly all CentOS/RHEL systems.



  1. Install livna and rpmforge repo.

  2. Add fedora-extras.repo:

    [fedora-extras]
    name=Fedora Extras 6 - i386
    #baseurl=http://download.fedora.redhat.com/pub/fedora/linux/extras/6/i386/
    mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=extras-6&arch=i386
    gpgcheck=0
    enabled=1
    includepkgs=libnjb* libtunepimp* libifp* libmtp* libgpod* libofa* amarok* xine-lib wavpack

    You see, we should include necessary packages only.

  3. Edit CentOS-Base.repo, add following lines:

    # exclude libgpod 0.4.0 to install libgpod 0.4.2 from FC6 repo for Amarok
    exclude=libgpod

  4. Add fedora-updates.repo:

    [fedora-updates]
    name=Fedora Core 6 - $basearch - Updates
    #baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/$basearch/
    mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-fc6&arch=$basearch
    enabled=1
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
    protect=0
    includepkgs=libnjb* libtunepimp* libifp* libmtp* libgpod* libofa* amarok*

  5. Edit rpmforge.repo, add:

    exclude=xine-lib

Monday, June 11, 2007

Disable one user's remote login on Linux

I have to disable one particular user's remote login on Linux, sounds simple, but it costed me some time. The normal way is to change PAM settings, using pam_access.so to control user login. Following steps are tested on Red Hat Linuxes (Fedora, RHEL, CentOS, etc.)

First you should enable pam_access.so:

  1. Unlink "/etc/pam.d/system-auth", which is a link to "/etc/pam.d/system-auth-ac".

  2. Create a new "/etc/pam.d/system-auth", includes all settings from "/etc/pam.d/system-auth-ac", like this:

    auth include system-auth-ac
    account include system-auth-ac
    password include system-auth-ac
    session include system-auth-ac

  3. Insert "pam_access.so":

    auth include system-auth-ac
    account required pam_access.so
    account include system-auth-ac
    password include system-auth-ac
    session include system-auth-ac



Now you can config pam_access.so by editing "/etc/security/access.conf", like this:

+ : player : LOCAL
- : player : ALL


For more info, read "man access.conf".

Wednesday, March 21, 2007

Use Exim with Gmail SMTP on Fedora

I've managed to setup Exim to send mail via Gmail SMTP on my laptop running Fedora Core 6. It was a bit tough work, for I can't find any precedent of using it on Fedora. Most talkings and guides regards Exim were based on Debian, and Fedora just doesn't have that config tools of Debian.

If you just want to know what to do, skip this paragraph, which talks theoratical things. My work started by following Use Gmail as a Smart Host, but it doesn't work. Checked Exim's log I found that the connection to Gmail's SMTP server was rejected, because Exim had been trying to connect to port 25 of it. Add a line "port = 587" solved this problem. Another problem is about the TLS authentication, because Exim thought the server it were to connect is called "gmail-smtp.l.google.com", which was got through DNS lookup, rather than the "smtp.gmail.com" set by me. So in the configure file, you should use "gmail-smtp.l.google.com" instead of "smtp.gmail.com."

So what to do is: edit "/etc/exim/exim.conf", add:

# routers section
send_via_gmail:
driver = manualroute
domains = ! +local_domains
transport = gmail_smtp
route_list = * gmail-smtp.l.google.com

# transports section
gmail_smtp:
driver = smtp
port = 587
hosts_require_auth = gmail-smtp.l.google.com
hosts_require_tls = gmail-smtp.l.google.com

# authenticators section
gmail_login:
driver = plaintext
public_name = LOGIN
client_send = : youraccount@gmail.com : yourpassword


I do think Exim should write an official FAQ regards this problem.

For some time, you may see such errors in Exim's log:

SMTP timeout while connected to gmail-smtp.l.google.com [72.14.253.109] after EHLO yourhostname: Conne
ction timed out


This is network or Gmail's problem. Want you can do is just waiting or switch to another ISP and try.

Monday, February 19, 2007

S60 Phone Error: Nokia 5500, "App. Closed: Calendar" (Solved)

I've got a problem with my mobile phone, Nokia 5500 Sports, bought 3 months ago.

Phenomenon:

  1. Phone detail: Nokia 5500 Sports, 3 months old. Symbian OS v9.1 (S60 3rd Edition).
    More detail from Nokia forum: http://www.forum.nokia.com/devices/5500


  2. Can't open the Calendar program. Before the Calendarprogram's graphical user interface was fully displayed, it crashed, exited automatically and an error message "App. Closed: Calendar" displayed by the system


  3. Entries in Calendar: two daily morning alarm entries. 3 to 5 other appointments. Very few data


  4. Every morning at the time when the daily morning alarms are supposed to ring, the whole phone would HANG. No operation is possible except for the "Task Switch" (long press Menu key), which would bring up the task list but no further operation is possible. The only way to recover is to remove the battery and wait until the display faded out


  5. Memory usage of phone main memory: half. Memory usage of memory card: 1/3


  6. I can think of NO particular operation that may be designated as the cause. Daily use is very common: phone, SMS, camera, web surfing, notes, etc.


  7. Haven't synced with PC before. After this problem occured, I tried to sync it with my PC by using bluetooth or IrDA, everything was synced successfully except the Calendar


  8. Two custom themes downloaded from local operator's website


  9. One or two custom rings transferred from my friend's MOTO phone by using bluetooth, 2 MONTHs AGO


  10. Installed 3rd party programs: Gmail client (Java)


  11. 2 weeks ago I've transferred 3 small Java games from another MOTO phone. But those games can't run on my phone & I deleted them


  12. Phone software edition (by dailing *#0000#): V 03.18 07-09-06 RM-86



Fix attempt:

  1. Reboot the phone, no help

  2. Sync with PC, no help

  3. Remove those custom programs & themes, no help

  4. Reset to factory settings (by dialing *#7780#), no help

  5. Whole phone backup, then format C: (by dialing *#7370#). After formating, the Calendar is OK, but after I restored my data by using Nokia's PC Suite, the Calendar broken again



Analysis:

My first guess is that the Calendar's data files are corrupted, so the bet maybe delete those files to reset the program. But for this 3rd edition of Symbian OS, I can't figure out which files are its data files (after a long search on net)! I checked some of the folders under C:\system\data but no good luck.

Solution:
Format C: (by dialing *#7370#), then sync my contacts back to phone. The trick is to avoid using whole system backup, which would keep the corrupted calendar data files.

PS:
I wanna try "Nokia Phone Software Update", but I've no cable now.

Friday, January 19, 2007

Configuration of Ad-hoc Wireless Network with Linux boxes

I've connected two Linux boxes (laptops) with wireless network without an AP. This is called "Ad-hoc Mode". It's as simple as connecting a wired network with a switch or hub. For a full explanation, please read this: http://en.wikipedia.org/wiki/Wireless_ad-hoc_network

Set up your wirelss NIC first. This varies upon different machine models. Usually a web search would solve your problem. For my scenario (Intel IPW2200 card on Fedora with rpm.livna.org), a "yum install ipw2200-firmware" is enough.

Then the only thing you need to config is your NIC's config file, usually named "ifcfg-eth?". For Fedora it's in "/etc/sysconfig/network-scripts/". Here's mine:

# Intel Corporation PRO/Wireless 2200BG Network Connection
DEVICE=eth1
ONBOOT=no
BOOTPROTO=none
TYPE=Wireless
USERCTL=no
IPV6INIT=no
PEERDNS=yes
NETMASK=255.255.255.0
DHCP_HOSTNAME=
IPADDR=192.168.0.2
DOMAIN=
HWADDR=
CHANNEL=1
MODE=Ad-Hoc
RATE=Auto
BROADCAST=192.168.0.255
NETWORK=192.168.0.0
ESSID=


To bring it up, use "ifup eth?".

Font Config of Gtk2 and Gnome2 Applications Outside Gnome2

I have switched from GNOME to KDE, and have been happy with it, since it's A LOT faster. A small problem is those GNOME applications will appear in default theme/font style regardless your settings done in GNOME. Perhaps they rely on some global environment settings that exists only when GNOME is loaded.

Here's a workaround from Ed Hurst: Gtk2 and Gnome2 Applications Outside Gnome2.

Quote:
Fonts: Create a config file in your home directory -- ~/.gtkrc-2.0. In this file, place one simple line:

gtk-font-name = "Arial 12"


Theme: To get the color scheme you like, choose one that is available on your system -- /usr/share/themes in SuSE/Fedora -- and make sure it is indeed Gtk2, as not everything there is. Edit ~/.gtkrc-2.0 and add a line like this one:

include "~/.themes/Dirty-Ice/gtk-2.0/gtkrc"

Quote end.

This is my ".gtkrc-2.0":

gtk-font-name = "Sans 12"
include "/usr/share/themes/Simple/gtk-2.0/gtkrc"


Have fun with KDE! :)

Thursday, January 18, 2007

Switched from MSN Space

I switched from MSN Space to here. Since MSN Space is extremely slow in Firefox on Linux, greatly reduced my ardor to write things with it.

About Me

My photo
Santa Cruz, California, United States