pithed.org » linux

linux


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.

picture unrelated

Just came across this excellent list of keyboard shortcuts for linux. Definitly worth a look.
linkage

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.

Well the random X.org crashes seem to have topped after I urpmi’d some updates. I really have to give it to the people at Seer Of Souls, as their repository is top notch and updated quite frequently.

If you didn’t know, seer of souls is an independant site that supplies software for the current version of Mandriva Linux. Most of their software is backported from Cooker (the beta version of Mandriva). Its an excellent way to get up to date software without having to resort to compiling from source.

This is especially useful if you don’t leave it on as one of your primary sources. This is pretty important as urpmi doesn’t make downgrading easy. In fact from what I can tell, it’s damn near impossible. So if you add seer of souls, think before you do a ‘urpmi –auto-select’ and update everything - you could regret it.

Well as a way of wasting time instead of studying for calculus, I did some reading up on how to install linux on my ipaq.

It didnt go well.

While trying to back up the ROM I borked it so now it won’t reboot. Removing the battery also doesnt seem to be hard resetting it due to the damned auxiliary battery. I wonder how long it lasts….

edit:

Well apparently running the update software works to fix it. I already had the newest firmware, but I re-updated anyway. That got it working as usual.

Linux will have to wait for now :/