So I read this and this and solved my problem. Basically I bind /temp/download to /media/$USER/download and then I can set the download directory in Chromium and Firefox snaps to /media/$USER/download and my downloads go where I want them. This was actually harder to figure out than it should have been.
Tag Archives: directory
Exclude hidden .svn files from grep query
To exclude .svn directories from a recursive grep, use the –exclude option, for example:
$ grep --exclude='*.svn*' -R 'your.*search' .
Apache2 REQUEST_FILENAME requires DOCUMENT_ROOT
I had a problem with my rewrite rules, that looked like this:
DocumentRoot /var/www/trust.jj5.net RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) http://trust.jj5.net/sorry.html [L,R]
I was trying to redirect any request which didn’t match a file or directory. The !-f and !-d requirements were failing because the path to the REQUEST_FILENAME wasn’t fully qualified. I fixed the problem by including the DOCUMENT_ROOT:
DocumentRoot /var/www/trust.jj5.net RewriteEngine On RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d RewriteRule (.*) http://trust.jj5.net/sorry.html [L,R]
Happy days! :)
Exclude .svn directories from grep
Today I learned how to Exclude .svn directories from grep:
grep -R --exclude-dir=".svn" search .
HTTPS+SSLVerifyClient require in <Directory>+big POST = Apache error
I was configuring MediaWiki to allow uploads and was getting an error in the browser about the POST data being too large (“does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit.”). I had a look in the Apache error log and found:
[Thu Feb 23 16:12:45 2012] [error] [client 60.240.67.126] request body exceeds m aximum size (131072) for SSL buffer, referer: https://www.jj5.net/morpheus/Speci al:Upload [Thu Feb 23 16:12:45 2012] [error] [client 60.240.67.126] could not buffer messa ge body to allow SSL renegotiation to proceed, referer: https://www.jj5.net/morp heus/Special:Upload
So I did some research. I found this document, File upload size which suggested editing /etc/php5/apache2/php.ini which I did:
upload_max_filesize = 20M post_max_size = 80M
That didn’t fix the problem though. I found Request entity too large which suggested checking my setting for LimitRequestBody, but that wasn’t the problem either.
Eventually I found Bug 491763 – HTTPS+SSLVerifyClient require in <Directory>+big POST = Apache error which suggested I needed to apply the SSLRenegBufferSize directive which I did like this:
<Location /morpheus> SSLVerifyClient require SSLVerifyDepth 1 SSLRenegBufferSize 20971520 </Location>
And then after restarting Apache the problem was solved.
Bash aliases for listing directories
I came up with two new bash aliases tonight. Enjoy.
alias lld='ls -alFd `find * .* -maxdepth 0 -type d`' alias lsd='ls -d `find * -maxdepth 0 -type d`'
Making directories executable and files read and writeable
I had a problem with my rsync backups. The problem was that the first time I ran it everything worked fine. The second time it ran (and all subsequent times) I got back the phone book of error messages, because the first time I’d run rsync it had copied in a whole heap of read-only files, and then when I ran it again it wasn’t able to overwrite those read-only files. At least I think that was what was happening. So I added the following to my backup script:
find . -type d -exec chmod u+x {} \; if [ "$?" -ne "0" ]; then echo "Cannot chmod directories in '$PWD'."; exit 1; fi find . -type f -exec chmod u+rw {} \; if [ "$?" -ne "0" ]; then echo "Cannot chmod files in '$PWD'."; exit 1; fi
This code runs after rsync and processes the files and directories that have been synchronised. That is, it processes the copy of the data, not the data I copied from.
For the copy of the data I want to make sure that the owner of the files can read and write them and that the owner of the directories can execute them. So that’s what the above code does.
Bash aliases for listing hidden files
I finally figured out the ls command to list hidden files, and decided to setup a ~/.bash_aliases file for the first time. My ~/.bash_aliases file is now:
alias l.='ls -d .[!.]*' alias ll.='ll -d .[!.]*'
So I have an “l.” command which will list hidden files and directories, and an “ll.” command which will list the same information in detail.