Some KTH computer tips

Table of Contents

Some notes on getting/sending mail with gnus

Gnus + kth + ssh-tunnelled-sendmail = true

The best way so far seems to be to use SSH-tunnelled sendmail (with kerbererized SSH, of course). E.g., first run

mkdir -p ~/share/bin
cd ~/share/bin
wget http://www.slac.com/~mpilone/projects/kde/kmailssh/sshsendmail.sh

and then put this into your ~/.emacs:

(setq sendmail-program "~/share/bin/sshsendmail.sh")

and you should be set.

Why is this better? Well, if you're travelling and send email via smtp at smtp.kth.se (rather than sendmail from one of the KTH computers), headers saying "Received from: blabla" will be appended, and this can make various spam filters classify your sent messages as spam (if blabla happens to be a black listed ISP.) This actually happened to me.

Gnus + kth + smtp = true

Note: even better than this is to use SSH-tunnelled sendmail, see above.

How to get gnus to send mail (say from a laptop) via KTH's smtp server: put the following in ~/.gnus and make sure you have gnutls installed. I suppose you'd better replace "your-user-name" below with, well, your user name.

(setq message-send-mail-function 'smtpmail-send-it
      smtpmail-starttls-credentials '(("smtp.kth.se" 587 nil nil))
      smtpmail-auth-credentials 
                   '(("smtp.kth.se" 587 "your-user-name@math.kth.se" nil))
      smtpmail-smtp-server "smtp.kth.se"
      smtpmail-smtp-service 587)
(setq starttls-gnutls-program "gnutls-cli")

Gnus + kth + imap + kerberos = true

On Ubuntu (it probably works on Debian too), the following will install the program imtest with GSSAPI capabilities:

apt-get install cyrus-clients-2.2
apt-get install libsasl2-modules-gssapi-heimdal

You can now put the following in your ~/.gnus:

(setq gnus-select-method '(nnnil))   ; It is hard to believe, but KTH 
                                     ; no longer has a news server!
(setq gnus-secondary-select-methods
      '((nnimap "KTH" 
	 (nnimap-address "mail1.kth.se")
	 (nnimap-stream gssapi)
	 (nnimap-authenticator  gssapi)
	)))

Gnus + kth + imap = true

Note: GSSAPI/Kerberos is a better solution (see above); with it you will not have to retype your password as often.

Put this into your ~/.gnus:

(setq gnus-select-method '(nnnil))   ; It is hard to believe, but KTH 
                                     ; no longer has a news server!
(setq gnus-secondary-select-methods
      '((nnimap "KTH" 
	 (nnimap-address "mail1.kth.se")
	 (nnimap-stream ssl)
	 ;(nnir-search-engine imap)   ; uncomment if you have nnir installed
	)))

Note: you might want to keep your old select method so that you still can read your nnfolder/nnml mail.

Using gssapi (kerberos) with ssh

How do I avoid typing my password so often?

Put this into your ~/.ssh/config

GSSAPIAuthentication yes
GSSAPIDelegateCredentials yes

To get tickets, type

kauth -f --no-addresses

Searching your imap mail via gnus

Install nnir and uncomment the "nnir-search-engine imap"-line above. Alternatively, consider using thunderbird to sift through your inbox.

Html tips for writing home pages

Don't! Use Org mode instead.


Find all ssh fingerprints on server

On the server, run:

ls /etc/ssh/*.pub| xargs -n 1 ssh-keygen -lf

# Newer sshd uses the SHA256 hash.  In case your client reports 
# the md5 hash, use:

ls /etc/ssh/*.pub| xargs -n 1 ssh-keygen -E md5 -lf

Some network tips and tricks

Find stuff on home network

nmap -sP 192.168.0.1/24

or, use arp:

arp -a

check open ports

sudo netstat -tunlp ahost.math.kth.se

Sound hangs on ubuntu

To restart, run:

pulseaudio -k && sudo alsa force-reload

or possibly

pulseaudio --kill
sudo alsa force-reload
pulseaudio --start

Other things to try is "pulseaudio –kill", then rm -r ~/.pulse (or ~/.config/pulse) and restarting.

If

sudo aplay /usr/share/sounds/alsa/Front_Center.wav

make sound, but user mode aplay does not, try:

aplay -D sysdefault:CARD=PCH  /usr/share/sounds/alsa/Front_Center.wav

Sometime master volume is muted, fix:

amixer -D pulse set Master 1+ unmute

power off external usb disk drive

Run:

udisksctl power-off -b /dev/sdX

Created: 2021-05-11 Tue 13:14