pithed.org » howto

howto


Want to increase convenience at the potential expense of security? Don’t we all. Well here’s how to authenticate without passwords*, and make aliases for your hosts while you’re at it.

First of all let me get that * out of the way. While it is possible to set up ssh logins with no password at all using this method, I recommend using a password when creating your key pair. This will give one master password shared between all logins that only needs to be entered once per session.

First of all you need to create a public/private key pair. I’ll assume you haven’t already done this.

user@machine:~$ ssh-keygen -t dsa -f ~/.ssh/id_dsa

It will prompt for a password. You should use one here, and use this key pair for several hosts. This would give the same password across all of the hosts. Or, you can just leave it blank. If you do that, then if anyone gets your private key file, they can access all of the servers that have your public key file. So especially if you leave the password blank, protect your private file!
You should now have 2 files in .ssh/. One will be your private key (id_dsa) and the other will have a .pub extension.

Now,
user@machine:~$ scp ~/.ssh/id_dsa.pub user@remote_host:.ssh/

Then log into the remote host,
user@machine:~$ ssh anotheruser@remote_host

And move the key into the authorized_keys file
anotheruser@remote_host:~$ cd .ssh
anotheruser@remote_host:~/.ssh$ cat id_dsa.pub >> authorized_keys2

And set the file permissions, if the file didn’t already exist.
anotheruser@remote_host:~/.ssh$ chmod 640 authorized_keys2

and delete the .pub file
anotheruser@remote_host:~/.ssh$ rm id_dsa.pub

You can now log out of the remote host. Try logging in again, it should just ask for the master password. For subsequent logins, no password should be needed.

Now, how about setting up an alias for the host name, and having SSH remember your login name? On the local system open the ~/.ssh/config file. Create it if necessary. Simply set up the aliases like this:

Host mybox
User anotheruser # remote login, if different
Hostname mybox.somedomain.com

Host anotherbox
Hostname anotherbox.anotherdomain.org

Once this is all set up, you should be able to ssh mybox, and the system will automatically select user name ‘myname’ and use the DSA key pair instead of a password.

So, youre sitting there listening to music and all of a sudden your amp clicks out, the power light goes red, and theres no music. ‘Shit. Its broken’, you think. Power off/on? Same thing.. Once it cools down, it powers up, but it clicks out again after 10 or 15 minutes of use.

Well if you found me by the google because precisely this happened to you, you’re in luck. I just repaired mine for the wonderful sum of 63 cents. Anyway, let’s move on.

To perform this fix you need to be somewhat comfortable with a soldering iron, and be willing to take your amp apart. If you aren’t very good with an iron, you’ll want to read through some how-to pages elsewhere until you’re comfortable with replacing capacitors on a printed circuit board.

nad c370 apart
My C370 ripped apart on my workbench

So it turns out the problem with the design is that NAD decided to put a hot-running diode right beside (touching!) some electrolytic capacitors. This dries out the caps, which changes their values. When their values change, the protection circuit goes all wonkey.

c370 protection circuit
The protection circuit

First of all, locate the protection circuit pictured above. As you can see from the picture, mine had some obvious heat problems. Nothing looks broken per se, but it looks nicely toasted, especially on the right side and top. To get it working again, I’d reccomend replacing the three topmost capacitors. Their values are 4.7uF, 47uF and 10uF all rated at 50V. I wouldn’t get anything larger than 50V as I’m not sure if it would fit.

**edit: According to Stu in the comments below, some amps have 63V caps, so I guess slightly larger caps might fit. Either way I wouldn’t recommend replacing your capacitors with new ones of a lower value than stock**

For those who are interested, here is the schematic for the protection circuit:

c370 protection module schematic
NAD C370 Protection Circuit Schematic

With those three caps replaced, the amp should work fine. But in a couple years, those caps will die too. I found a great solution on a forum: move the diode to the other side of the board. Watch the polarity!

protection mode cct done
Diode on the back of the board

Now apply power, hope there aren’t any sparks, and enjoy the music!

I’ve recently wanted to rip some CDs to several different formats at once. Say a FLAC copy for the computer, and an mp3 for the portible. After some searching, Abcde (A Better CD Encoder) seems to be the best package on linux for this. It is based around a bash script that will do CDDB lookups, and then use cdparanoia to rip the files, and encode them in your chosen formats.

$abcde -o mp3,flac,ogg

Its as easy as that. You’ll have to change the settings in the config file. Its located at /etc/abcde.conf (obviously..). I uncommented and changed these:

LAMEOPTS=’-V 0′

OGGENCOPTS=’-q 6′

To set mp3 encoding at alt-preset-extreme, and ogg encoding at Q6.

I have also edited a little bash script I found. It’s available here. When run, it will make .m3u files for all mp3s in the current directory and all subdirectories. Just put it in your path.

Lately I’ve been trying to smooth out my linux experience, as I’ve had the same system running for long enough that it seems worthwhile. One of the things thats always been a bit shaky is the use of my iPod. I’ve recently got ejecting to work well, but to make the amarok integration slicker I wanted a /dev/ipod entry. So, to do this

Make an entry in /etc/udev/rules.d/00.rules along the lines of

##iPod
BUS=”scsi”, SYSFS{model}=”iPod*”, NAME=”ipod%n”

This will search all new devices, and if their model matches iPod it puts them at /dev/ipod[n] with n being the partition number.

Over the past few weeks I’ve been getting annoyed with the distributed.net client while doing cpu intensive things. Its easy enough to su, /etc/init.d/dnetc stop.. but even that can get to be a bit much. I figured an icon would be much nicer. The issue then, is allowing me as a regular user to operate init.d scripts.

Now I’ve tried using chmod+s before and had some success, but it didn’t seem to be working here, plus thats not really the right way of doing it. It turns out configuring sudo for this task is really simple.

Simply type a

visudo

And you’ll see the /etc/sudoers file (must use visudo though..)

I then added

User_Alias RANDOM = random

and

Cmnd_Alias CMD_DNETC = /etc/init.d/dnetc

Then gave myself the permissions with the following entry

RANDOM ALL = NOPASSWD: CMD_DNETC

Obviously the aliases weren’t required in this simple configuration, but I figured I might as well do it right, as I’m sure I’ll start to use this more now that I know how. The NOPASSWD option makes it so sudo doesn’t ask me for my user password (how useless would that be?). Now I can run the command as a user by simply typing (or pointing an icon to)

sudo /etc/init.d/dnetc

Works like a charm.