Saturday, May 31, 2008
Finicky ssh: ssh keypairs for password-less login
I use cygwin to connect to remote linux machine. Yeah, call me a hypocrite, who likes command-line, yet sticks to XP.
You can learn about setting up keypairs here.
After generating key pairs, I copied the public key to remotehost:/home/myusername/.ssh/authorized_keys. And it failed to work. The trick I had to use is the correct perms for .ssh directory and authorized_keys. The .ssh directory requires perms of 700 and authorized_keys 600. You can check /var/log/secure (on FC distro, dunno about others) to see the log.
Now, it is working fine.
You can learn about setting up keypairs here.
After generating key pairs, I copied the public key to remotehost:/home/myusername/.ssh/authorized_keys. And it failed to work. The trick I had to use is the correct perms for .ssh directory and authorized_keys. The .ssh directory requires perms of 700 and authorized_keys 600. You can check /var/log/secure (on FC distro, dunno about others) to see the log.
Now, it is working fine.
Labels: ssh
Monday, May 26, 2008
Making Tomcat follow symbolic links (symlink)
Suppose, if you wish to put the media files in /some/other/location, that needs to be accessed via tomcat from the webapps directory, you can create a symlink for the destination in webapps. But tomcat doesn't follow the symlinks to pick the resource by default. You can instruct the tomcat to follow links by modifying conf/context.xml. Here, add attribute to tag as
It works.
It works.
Labels: tomcat
Monday, May 19, 2008
Remove the namespace attribute from html
If you are constructing xml document from html and the original html has unwanted namespace attribute, you can easily remove it with HtmlCleaner.
From the javadoc
From the javadoc
HtmlCleaner cleaner = new HtmlCleaner(...);
cleaner.setNamespacesAware(false); // ignore namespace.
claener.clean();
cleaner.createDOM/createJDOM(); // Get the output as you want.
HTML entity decoding with java
Parsing html document and need to extract the text with replaced by a white space? Head over to unescapeHtml method StringEscapeUtils for the solution. Download the Apache Commons Lang package here.
Subscribe to Posts [Atom]