The Lumber Room

"Consign them to dust and damp by way of preserving them"

Archive for November 2005

Getting ISO 8601 format time on PHP boards

leave a comment »

Try Y-m-d H:i:s O. It always shows the timezone offset as +0000, though. The only fix I’ve found for this is to actually hard code the timezone — I’m using Y-m-d H:i:s +0530 as the literal string for the date format on this non-blog.

The relevant pages are the PHP docs and Markus Kuhn’s page.

Advertisement

Written by S

Tue, 2005-11-22 at 15:13:00

Posted in compknow

ssh-keygen as another user

with 4 comments

To set up an ssh-key usually, type
ssh-keygen -t rsa, hit [Enter] a few times, type
cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys, and add entries from other places where you might have created a key, to the same authorized_keys.

To set it up so you can log in as another user (called, say, user2)
ssh-keygen -t rsa
Enter a different file to save (id_for_user2, say), and blank passphrase.
Now add the contents of the file id_for_user2.pub to user2‘s ~/.ssh/authorized_keys file.

Oh, and when you want to login as that user, you will have to specify that you want to use that file, like
ssh -i ~/.ssh/id_for_user2 user2@hostname. For long commands like this, it’s best to make an alias (put alias sshasuser2='ssh -i ~/.ssh/id_for_user2 user2@localhost' in your ~/.bashrc if all you want is a password-less replacement for su - user2). You can also give the id_for_user2 file to others, and they can also login as user2 without a password simply by typing the command above.

Got it from this linux.debian.user newsgroup post.

Written by S

Thu, 2005-11-17 at 13:01:00

Gnome File Selector

leave a comment »

Although there is no indication anywhere, one can actually start typing, and a box will appear to accept your input. This is incredibly unintuitive, but who’s to argue with the folks at GNOME? (Actually, even Gaim has this “feature”—start typing in the buddy list window to see it. So it could be a GTK+ thing, and not a GNOME thing…)

There are actually two places that take input:

  • The one that pops up when you start typing the name of a directory, say. This is at the bottom-right corner, and isn’t very good. No autocompletion.
  • There’s another one, that pops up when you type Ctrl+l (that’s l for location) or when you start typing with a /. This one has autocompletion, but works a bit weirdly: it interprets each keystroke as occurring after the completion (so if you start typing /etc, it will go into /etc after the ‘e’, then look for files beginning with ‘/etc/t’). Another problem is that it’s not done until you actually type the whole thing. For instance, to open /usr/bin/emacs, it is not enough to type “/u[sr/]b[in/]em[acs]{RET}” — that makes it look for “/usr/bin/em”. You can’t type “/u[sr/]b[in/]em[acs]a…” either: those files don’t exist. The only thing you can do is “/u[sr/]b[in/]em[acs]{Backspace}s{RET}”. Very weird. And if the file you want is inside the home directory, it can be got with “/{Backspace}~/…”.

Also, when “/bin/” or “/usr/bin” has too many files, opening one of them can take quite a long time. A “solution” is to have a separate directory (like “/usr/freqbin”) that contains links to all the programs that one might want to use to open things downloaded from the net (because the File Selector is encountered mostly when using Firefox).

2007-10-26: At some point, it started accepting “~” too, so you don’t have to do “/{Backspace}~” now. The rest of the mess is still there.

Written by S

Sun, 2005-11-06 at 17:03:00