1 / 3
Caption Text
2 / 3
Caption Two
3 / 3
Caption Three margin testing

Wednesday, June 30, 2010

“Tinyurl”-ify DropBox Public Links With .htaccess

http://ubuntu-tutorials.com/tag/dropbox/
November 8th, 2008

I just recently started using DropBox on Ubuntu 8.10 "Intrepid Ibex" and leftyfb in IRC pointed out to me a nifty little trick with .htaccess files. If you've been using DropBox I'm sure you've seen or made use of the Public folder and sharing files. You may have also noticed that the DropBox Public links are long and likely hard to remember when needed.

One thing that you can do, if you have your own web server, is dynamically generate these public links. For example:

Original DropBox Public URL:

http://dl.getdropbox.com/u/312414/Christer_Edwards.asc

DropBox Public URL with .htaccess trick:

http://zelut.org/dropbox/Christer_Edwards.asc

In order to accomplish this you'll need access to a webserver and the ability to create and use a .htaccess file. On my webserver I created a folder called "dropbox" and then pasted the following into a new file, .htaccess:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://dl.getdropbox.com/u/012345/$1 [L,QSA]

You will need to replace the "012345″ with your unique ID. As you notice from the original link above, my unique ID is "312414″. You can find yours by copying the public link within Nautilus.

Once this is done you can share files by placing them into your DropBox Public folder and then appending the filename to your webserver URL + created folder. Again, since I created the folder "dropbox" on http://zelut.org/, my url is http://zelut.org/dropbox/. I simply append the filename I want to share and its done!

If anyone can suggest a way to present this URL with an index.html that may be a cool trick.

Relaying Postfix SMTP via smtp.gmail.com

http://ubuntu-tutorials.com/2008/11/11/relaying-postfix-smtp-via-smtpgmailcom/
November 11th, 2008
( With little changes these steps worked on PigBookVMu, a Ubuntu 10.04 in VMware workstation, HL 20100630)

I've got a few servers in different places around the country and try to monitor them using the logwatch utility. One problem that I've run into however is that a few of these servers are not able to send their logwatch emails to me, based on email restrictions by the ISPs. I spent some time this afternoon researching what was required to have my servers authenticate to my gmail account and send me the mail that way. This setup assumes Ubuntu 8.04 (or later) and Postfix.

Install the required packages

sudo aptitude install postfix libsasl2 ca-certificate libsasl2-modules

On Ubuntu 10.04 (HL)

aptitude install postfix libsasl2-2 sasl2-bin libsasl2-modules procmail

Configure Postfix

This tutorial will not outline how to configure your postfix server, but we'll jump directly to the relayhost section. You'll want to add the following lines to your /etc/postfix/main.cf file:

relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes

The above lines are telling Postfix that you want to relay mail through gmail on a specific port, telling it to authenticate, and where to find the username and password. The last three lines specify the authentication types supported, where the certificate authority file is and that it should use tls.

Define Username and Password

Next we'll need to populate the sasl_passwd file. Create the file /etc/postfix/sasl_passwd with the following contents:

[smtp.gmail.com]:587 user.name@gmail.com:password

This file should have restrictive permissions and then needs to be translated into a .db that Postfix will read.

sudo chmod 400 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd

At this point you can restart Postfix and it should work, however it will complain about not being able to authenticate the certificate. To take care of this issue we'll use the ca-certificate package we installed and tell it where it can validate the certificate.

cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem

Go ahead and reload postfix (sudo /etc/init.d/postfix reload) and you should be set.

If this article has been helpful, please consider linking to it.

Mutt Quick Reference Chart

http://www.ucolick.org/~lharden/muttchart.html

This is a chart of common Mutt commands, the context(s) in which you could use them, what they do, the section(s) of the tutorial that explain them, and which .muttrc settings affect them.

Note: some commands may appear more than once if their effects differ depending on context.

Mutt CommandContextEffectTutorial SectionRelevant .muttrc settings
aSending Message Attaches a file to the message you have createdSending Messagesnone
bSending MessageLets you edit the list of blind carbon copy recipients for the message you have created Sending Messagesnone
cSending MessageLets you edit the list of carbon copy recipients for the message you have createdSending Messages none
dMain Menu, Reading MessageMarks the current message for deletionDeleting Messagesnone
fMain Menu, Reading Message Forwards the message to another addressForwarding Messagesaskbcc, askcc, edit_headers, editor
iReading MessageReturns from reading a message to the Main Menu Reading Messagesnone
jMain MenuChanges the selected message to the next messageGetting Around in the Menu color
kMain MenuChanges the selected message to the previous messageGetting Around in the Menucolor
mMain Menu, Reading Message Creates a new message to sendSending Messagesabort_nosubject, abort_unmodified, askbcc, askcc, edit_headers, editor, recall
muttCommand line Starts muttGetting Into and Out of the Mutt Menubeep-new, color, mark_old, move, sort
pMain Menu, Reading MessagePrints the currently selected message Printing Messagesprint, print_command
qMain MenuQuits muttGetting Into and Out of the Mutt Menu delete, mark_old, mbox, move
qSending MessageAborts or postpones the message you have createdSending Messages orPostponing Messages postpone, postponed
rMain Menu, Reading MessageCreates a reply to the current messageReplying to Messagesabort_nosubject, abort_unmodified, askbcc, askcc, edit_headers, editor, include, metoo
sMain Menu, Reading MessageSaves the current message to a fileSaving Messagesfolder
sSending MessageLets you change the subject for the message you have created Sending Messagesnone
tSending MessageLets you edit the list of recipients for the message you have createdSending Messages none
uMain Menu, Reading Message (messages marked for deletion only)Removes the deletion mark from the current messageDeleting Messages none
xHelp MenuReturns from the help menu to the Main MenuGetting Around in the Menunone
ySending Message Sends the message you have createdSending Messagesabort_unmodified, copy, record
?Main MenuGoes from the Main Menu to the Help Menu Getting Around in the Menucolor
-Reading MessageMoves to the previous page in the message you are readingReading Messages none
/Main MenuPrompts for a pattern to search for in the headers of your messagesGetting Around in the Menunone
=Main MenuSelects the first messageGetting Around in the Menucolor, sort
$Main MenuDeletes all messages selected for deletion, and checks for new messages Deleting Messagesbeep_new, delete, mark_old, mbox, move
*Main MenuSelects the last messageGetting Around in the Menu color, sort
< number >Main MenuSelects message < number >Getting Around in the Menucolor
< Enter > Main MenuBrings the currently selected message up on the screenReading Messagescolor
< Space >Reading MessageMoves to the next page in the message you are reading, or to the first page of the next message not marked for deletion Reading Messagesnone
< Tab >Main MenuSelects the next new messageGetting Around in the Menu color
< Esc > /Main MenuPrompts for a pattern to search for in the bodies of your messagesGetting Around in the Menunone
up/down arrowMain MenuChanges the selected message to the previous/next messageGetting Around in the Menucolor
PageUp/PageDown Main Menu, Reading MessageMoves up/down one page in the Main Menu or the message you are readingGetting Around in the Menu or Reading Messages none

Explanation of Chart Columns

  1. Mutt Command is a command you type in, either at your shell prompt or while mutt is running.
  2. Context is the circumstances under which you would use this command. The contexts are:
    • Command line. This is your shell prompt, with mutt not running.
    • Main Menu. This is the main Mutt menu, in which you will see a list of your messages.
    • Help Menu. This is Mutt's online help menu.
    • Reading Message. This is when you are reading a message.
    • Sending Message. This is when you have finished editing a message, and are preparing to send it.
  3. Effect gives a brief explanation of what this command will do. See the tutorial for more details on commands.
  4. Tutorial Section is the section in the tutorial "Learning Mutt" with an explanation of this command.
  5. Relevant .muttrc settings lists the .muttrc settings that will affect the behaviour of this command.

Featured Post

Windows和Ubuntu双系统完全独立的安装方法

http://www.ubuntuhome.com/windows-and-ubuntu-install.html  | Ubuntu Home Posted by Snow on 2012/06/25 安装Windows和Ubuntu双系统时,很多人喜欢先安装windows,然...