redirecting sudo output

Posted on January 25th, 2005 in , by jud || Add A Comment

Sometimes I need to use the linux sudo command to run another command as another user, but also write the output of that command as another user. I always forget the proper syntax for this sort of thing, since simple quoting and escaping don’t work. Ryan pointed out a straightforward way to accomplish it.

For example, if I wanted to run a command as *apache* when running as user *me*,

(me@home) $ sudo -u apache command 

However, trying to redirect the output of the command will cause the output to be written as user *me*, not *apache*, causing
an error when writing to a directory or file not writable by *me*.

(me@home) $ sudo -u apache command > /home/apache/out
bash: /home/apache/out: Permission denied

Ryan’s solution is as follows: use sudo to call an shell with the quoted command as a parameter:

(me@home) $ sudo -u apache /bin/bash -c "command > /home/apache/out"

Add A Comment

Simple forums with FUDforum and mailman

Posted on January 23rd, 2005 in , , by jud || Add A Comment

I set up an online forum and mailing list for a class I’m taking. I used FUDforum, which was easy to install and
configure (it’s php). One of the other things I wanted to do was to set up a mailing list that would serve as an alternate entry point for users: mailing list posts would be copied to the forum, and forum posts would be copied to the mailing list. Using mailman and procmail, this was relatively simple. After downloading and installing fudforum, I installed mailman from RPM using the yum package manager. Following the instructions in the docs, I created a mailing list and added some test names.

After setting up the mailing list, I configured FUDForum to post to the mailing list (using the mailing list options), and got it to remove the title of the mailing list when copying to forums. This was slightly tricky, since the regulur expression should be [ListName], not [ListName].

Then I added procmail entry that pipes any list mail into the FUDforum mailinst list script (scripts/maillinglist.php). I had to fiddle with the permissions a bit since the web owner wasn’t receiving the mail, but a set of directories with a special group, and group write/set permissions did the trick. I did have much more trouble with the procmail recipeit since it wasn’t clear when mail should be copied to the forum. Because mailling list mails are sent via BCC, the recipient doesn’t show up in the header all the time (I tried using a special mailing list email address). In the end, I had to for mail with the mailing list name as the recipient, which seems to work most of the time,. However, I just discovered that if someone BCCs the list, the mailing list doesn’t even show up in the To: field.

However, the forum is now up and working, and students can post to the list, or the forum, and everyone sees the messages.

Add A Comment

New Camera: Canon 20D 8MP DSLR

Posted on January 12th, 2005 in , by jud || Add A Comment

This Christmas I decided it was time to upgrade my canon D60 camera. It’s nearly two years old, positively ancient! I briefly experimented with the Canon Powershot G6, and although I liked the video feature, I simply found it too limiting to use a non-DLSR. I have a nice variety of canon lenses for the D60 which give me much more flexibility, and although the small point and shoot would be handy, it wasn’t truly small enough to put it in my pocket and forget about it. So as someone described it, it was the “worst of both worlds.” That being said, I had many great experiences with the G1 before I got into more “serious” cameras, and the G6 would be a good camera for someone not willing to go the full monty with a DSLR.

All that is just preamble for the main event– I decided to get the new Canon 20D, and keep the D60 as a backup. I’m very pleased with it so far, and for me the best improvements are as follows: It’s FAST (5 frames per second)!, has better flexibilty with the raw/jpeg/both shooting formats, has a sensor that autorotates pictures taking in portrait mode (a HUGE annoyance with the D60!), has much better low light shooting (low noise and better focusing). I’ve shot a few hundred pictures with it, and I’m very pleased overall. It’s a significant but not monumental step forward, and I feel very comfortable knowing that I have a capable backup camera. I got the 18-55 kit lens which was a mistake (I misread the specs, and thought it had image stabilization. That’s the 17-85 IS for about $500 more!). I purchased the camera from, the same place I got the G6. Excellent price, speedy delivery, and no problems.

If you’re interested, dpreview has a nice review that I found to be helpful in making my decision.

Add A Comment