VanDyke Secure CRT - bind: Permission Denied Error when connecting to Ubuntu SSH Server

April 12, 2008 on 5:56 pm | In linux, software | No Comments

When using Windows, I use VanDyke SecureCRT to connect to my Linux machines, which include servers running Red Had Enterprise Linux (RHEL), CentOS, and the Debian-derived Ubuntu. Everything was working fine until today.

Though I was playing around with the SSH configuration files to get SFTP transferred files to set a specific file permissions mask (umask), I don’t think I changed anything that would have caused this error:

“Connection to session XXXX failed: The server has disconnected with an error. Server message reads: A protocol error occurred. bind: Permission denied.”

eoe-crt-error.jpg

“Connection to session XXXX failed: The server has disconnected with an error. Server message reads: A protocol error occurred. bind: Permission denied.”

The problem occurred on the Debian/Ubuntu based machine. Interestingly, the error only occurred when using SecureCRT - sftp via Sftpdrive worked great, and connecting to the machine via other SSH clients worked fine as well.

After trying everything I could think of, including changing authentication methods, user names, etc, and after much searching, I finally found a solution over in the HP forums:

Got it working. Fix is:
in SecureCRT

Options -> Global Options -> SSH2 Options

Turn off Option: Enable OpenSSH agent forwarding

eoe-crt-fix.jpg

Easy enough fix, but it took me about an hour to find the solution. If yo urun into the same problem, hopefully you’ll find this post much quicker than I found the HP solution.

Like this story? Share with others on:
      del.icio.us    digg    reddit    furl
      

How To Block an IP Address On Linux / Apache Server

April 11, 2008 on 11:41 am | In internet, linux, programming, security | No Comments

I operate a number of websites, some quite large as far as total “number of pages.” Over the years, I’ve noticed an increasing number of poorly behaved web crawler applications - some completely ignore the robots.txt file, and more and more submit dozens of requests per minute. (eek!) For a site with thousands and thousands of pages, this can negatively impact server performance. Severely.

While I do have a few methods for blocking these guys in place, just this morning I noticed that one particular crawler, identifying itself as “INA dlweb; http://ina.fr/” and coming from 195.221.138.170, was really killing my machine. The only solution was to reconfigure my firewall to drop all packets coming from this IP address.

If you’ve got a server with the very popular LAMP setup (Linux/Apache/Mysql/Php), you can likely do the same.

Here’s how: As root, enter:
iptables -A INPUT -s a.b.c.d -j DROP

, where a.b.c.d is the IP address of the offending web bot. In my case, I entered “iptables -A INPUT -s 195.221.138.170 -j DROP”.

Worked like a charm - my server load dropped drastically:

Before the Change:
10:37:01 up 241 days, 18:20, 3 users, load average: 1.26, 0.70, 0.47
10:38:01 up 241 days, 18:21, 3 users, load average: 1.13, 0.73, 0.49

After the Change:

11:21:01 up 241 days, 19:04, 3 users, load average: 0.40, 0.55, 0.64
11:22:01 up 241 days, 19:05, 3 users, load average: 0.31, 0.52, 0.62
11:23:01 up 241 days, 19:06, 3 users, load average: 0.11, 0.42, 0.58

This method should work on most flavors of Linux, including Ubuntu, CentOS, Red Hat, Debian, etc.

Like this story? Share with others on:
      del.icio.us    digg    reddit    furl
      

Automatically renaming files downloaded with Coast to Coast AM Media Center

April 7, 2008 on 9:07 pm | In perl, productivity | No Comments

I’m an insomniac.

I have trouble falling asleep at night because thoughts never seem to stop racing through my head - Did I do X yet? What if I did Y? Ooh, I could make it easier to do Y … Hey, I have a cool idea for an awesome invention… and I’m starting to get excited about it … (!)

Listening to radio shows helps me quiet my mind & get to sleep. To that end, I use the Coast to Coast AM Media Center to automatically download shows from the Coast to Coast AM website. (Sure, the content can be really nutty from time to time, but I treat it as entertainment & fiction, not a show to be taken seriously.) One of the limitations of the downloader is that the downloaded mp3s don’t have very useful names - instead of being named something useful, like “03-20 John Titor and Time Travel,” the files instead carry largely useless names such as “Coast to Coast - Mar 20 2008 - Hour 2.mp3.”

I wrote the below perl script to make the downloaded file names more useful. It connects to the Coast to Coast AM website, looks up the file name, creates a directory with that filename, then moves the downloaded mp3s to that directory. To run the script on your Windows machine, you’ll need to have the Cygwin suite installed, along with the cygwin perl module.

#!/usr/bin/perl

$DIR="/cygdrive/c/Documents and Settings/eddie/My Documents/coast to coast am media center";

opendir (DIR, $DIR) or die "cant open dir $DIR";
while (my $file = readdir (DIR)){
   if ($file=~/mp3$/){
      #process mp3 file
      #print "$file n";
      $file=~/(w+) ([0-9]+) ([0-9]+)/;
      #$file=~/^.+? (w) ([0-9]+) ([0-9]+) .+$/;
      #print "mon $1 n day $2 n year $3n";
      $y=$3;
      $month=$1;
      $d=$2;

      print "month is $monthn";
      if ($month eq  "Feb"){
         $m="02";
      }elsif($month eq "Mar"){
         $m="03";
      }elsif($month eq "Apr"){
         $m="04";
      }elsif($month eq "May"){
         $m="05";
      }elsif($month eq "Jun"){
         $m="06";
      }elsif($month eq "Jul"){
         $m="07";
      }elsif($month eq "Aug"){
         $m="08";
      }elsif($month eq "Sep"){
         $m="09";
      }elsif($month eq "Oct"){
         $m="10";
      }elsif($month eq "Nov"){
         $m="11";
      }elsif($month eq "Dec"){
         $m="12";
      }elsif($month eq "Jan"){
         $m="01";
      }else{
         $m="XX";
      }

      $date_string = $m . "-" . $d;

      if ($SHOWS[$y-$m-$d]){
         $title=$SHOWS[$y-$m-$d];
      }else{
         $url = "http://www.coasttocoastam.com/shows/$y/$m/$d.html";
         #print "getting URL $url...n";
         #<h2><a name="recap"></a>Title</h2>
         system("wget -q -O /tmp/temp.$$ $url");
         $file_contents = `cat /tmp/temp.$$`;
         $file_contents=~/<h2><a names*=s*"recap"></a>(.+?)</h2>/;
         $title = $1;
         $title=~s/&/and/gis;
         $title=~s/:/-/gis;
         $title=~s/!//gis;
         $desc=~s/<.+?>//gis;
         print "TITLE:  $titlen";
         $SHOWS[$y-$m-$d] = $title;
         system("rm  /tmp/temp.$$");
      }

      ## move the file to the proper directory
      $dirname = $date_string . " " . $title;
      if (-e "$DIR/$dirname"){
         #dir already exists
      }else{
         $cmd="mkdir  \"$DIR/$dirname\"";
         system ($cmd);
      }

      $cmd = "mv \"$DIR/$file\" \"$DIR/$dirname\"";
      #print "want to $cmdn";
      system ($cmd);

   }
}
close DIR;

Like this story? Share with others on:
      del.icio.us    digg    reddit    furl
      

Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds. Valid XHTML and CSS. ^Top^
32 queries. 0.204 seconds.