Showing posts with label tip. Show all posts
Showing posts with label tip. Show all posts

2009-02-12

How to Mount a Remote SSH Filesystem using sshfs

Ran across this bit in the Ubuntu Wordpress Blog: How to Mount a Remote SSH Filesystem using sshfs

The sshfs can be used to mount and unmount remote file systems in user space over an SSH tunnel.

The sshfs program was not installed by default.

This program (sshfs) is relate to the FUSE user-space file system architecture.

  1. create /media/<MOUNTPOINTNAME>
  2. chown the newly created directory to belong to the current user
  3. issue 'sshfs user@host:/path /media/<MOUNTPOINTNAME>' to mount the remote filesystem

Adding to the Perl Include Path

[this is from the Perl Module Installer documentation supplied with cPanel and CenOS]

Suppose you need to add a path - say /home/earthsid/perl - to the Perl include path. You will need to modify the Perl code to set the INC path in the BEGIN block of the program.

You can do this by adding the following code to your script:

BEGIN {
    my $homedir = ( getpwuid($>) )[7];
    my @user_include;
    foreach my $path (@INC) {
        if ( -d $homedir . '/perl' . $path ) {
            push @user_include, $homedir . '/perl' . $path;
        }
    }
    unshift @INC, @user_include;
}

Note that - no matter where the BEGIN block resides in a program, it is always excuted first, before ay other part of hte script lib.

Installing OpenSuSE 11.1 over the Internet

You will need to know these to get the NET install started...

Net Install Parameters:
  Protocol: HTTP
  Host: www.gtlib.gatech.edu
  Path: pub/opensuse/distribution/11.1/repo/oss/

Net Install CD:
  http://www.gtlib.gatech.edu/pub/opensuse/distribution/11.1/iso/openSUSE-11.1-NET-i586.iso

ISO Directory:
  http://www.gtlib.gatech.edu/pub/opensuse/distribution/11.1/iso/

Furthermore, you may need to install these lines into your /etc/hosts file:

## added to solve un-explained "Couldn't resolve host..." error
## while installing OpenSuSE 11.1 (NET) - these lines provide the
## hostname->to->ip address mappings for the OpenSuSE mirrors; 
## NOTE:  These addresses should be checked and updated before use!  
## These is just what the 'host' command returned today...
##     -pdwilso(at)gmail.com
128.8.235.18    mirror.umoss.org
134.174.150.123 mirrors.med.harvard.edu
149.20.20.135   .kernel.org
64.50.236.216   suse.mirrors.tds.net
204.152.186.174 opensuse.ca.unixheads.org
64.50.238.52    ftp.osuosl.org
64.50.236.52    ftp.osuosl.org
146.137.96.15   mirror.anl.gov
146.137.96.7    mirror.anl.gov
198.60.22.13    mirrors.xmission.com
146.6.54.21     ftp.utexas.edu
72.3.128.167    mirror.rackspace.com
155.98.64.86    opensuse.cs.utah.edu
129.21.2.111    mirrors.rit.edu
64.90.181.77    mirror.nyi.net
80.237.136.138  ftp.hosteurope.de
156.56.247.193  ftp.ussg.iu.edu

Hosts file: uploads/opensuse-mirror-hosts-20090212.txt

An odd aspect of the DNS name resolution problem: For some reason, Konqueror could not resolve host names, but 'host' could.

Finally, here is a script that I used to create the hosts listing:

#!/bin/sh
host $1 | perl -e 'while(<>){\
  chomp;m/([a-z.]+) has address ([0-9.]+)/ && print"$2\t$1\n";\
}'

This script is used like:

  getip.sh mirror1.kernel.org

and returns

  <IP-Address>\t<Hostname>

If you've got root, the output of getip.sh can be used thus:

  getip.sh mirror1.kernel.org >> /etc/hosts

Of course there are other ways to do this. Of course you should check the output of getip.sh before appending it to /etc/hosts.

Caveat emptor. YMMV. Don't take any wooden nickels.