Sunday, January 25, 2009

Mount Folder on Remote Computer with SSHFS

1. You must sure, on local computer and remote computer already have SSH.
2. Install SSHFS on local computer

Code :

# yum install sshfs


Example :

[root@msmunir1 ~]# yum install sshfs

Loaded plugins: refresh-packagekit

Setting up Install Process

Parsing package install arguments

Resolving Dependencies

--> Running transaction check

---> Package fuse-sshfs.i386 0:2.2-1.fc9 set to be updated

--> Finished Dependency Resolution


Dependencies Resolved



================================================================================================================
Package Arch Version Repository Size

================================================================================================================
Installing:

fuse-sshfs i386 2.2-1.fc9 updates-newkey 49 k


Transaction Summary

================================================================================================================
Install 1 Package(s)

Update 0 Package(s)

Remove 0 Package(s)


Total download size: 49 k

Is this ok [y/N]: y

Downloading Packages:

fuse-sshfs-2.2-1.fc9.i386.rpm | 49 kB 00:02

====================================================================== Entering rpm code
============================================
Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : fuse-sshfs 1/1

======================================================================= Leaving rpm code
===========================


Installed:

fuse-sshfs.i386 0:2.2-1.fc9


Complete!

[root@msmunir1 ~]#


3. Make sure, the fuse module already loaded on local computer. If did not, loaded with :

Code :

# modprobe fuse


Example :

[root@msmunir1 ~]# modprobe fuse


4. Chek the fuse module :

Code :

# lsmod


Example :

[root@msmunir1 ~]# lsmod

Module Size Used by

vfat 12672 1

fat 42912 1 vfat

usb_storage 86536 1

nf_conntrack_ftp 10660 0

nf_conntrack_irc 8868 0

xt_TCPMSS 7552 0

xt_owner 6400 0

xt_mac 5632 0

xt_length 5632 0

xt_state 5888 0

xt_limit 6020 0

xt_multiport 6784 0

xt_conntrack 7680 0

nf_conntrack 51424 4 nf_conntrack_ftp,nf_conntrack_irc,xt_state,xt_conntrack

ipt_ULOG 10632 0

ipt_ttl 5504 0

ipt_ecn 5760 0

ipt_REJECT 6656 0

ipt_LOG 8836 0

ipt_recent 10908 0

iptable_filter 6528 0

iptable_mangle 6656 0

ip_tables 13712 2 iptable_filter,iptable_mangle

x_tables 15236 15
xt_TCPMSS,xt_owner,xt_mac,xt_length,xt_state,xt_limit,xt_multiport,xt_conntrack,ipt_ULOG,ipt_
ttl,ipt_ecn,ipt_REJECT,ipt_LOG,ipt_recent,ip_tables

bridge 43668 0

stp 6148 1 bridge

bnep 14848 2

rfcomm 33936 4

l2cap 21504 16 bnep,rfcomm

vboxdrv 57856 0

fuse 49436 3

sunrpc 155924 3

cpufreq_ondemand 9868 2

acpi_cpufreq 12172 0

loop 17164 0

dm_multipath 17292 0

scsi_dh 9476 1 dm_multipath

ipv6 230260 30

snd_hda_intel 395800 4

snd_seq_dummy 6660 0

sr_mod 17064 0

cdrom 32664 1 sr_mod

snd_seq_oss 30364 0

snd_seq_midi_event 9600 1 snd_seq_oss

8139cp 21504 0

snd_seq 48320 5 snd_seq_dummy,snd_seq_oss,snd_seq_midi_event

arc4 5760 2

snd_seq_device 9996 3 snd_seq_dummy,snd_seq_oss,snd_seq

ecb 6528 2

snd_pcm_oss 41600 0

firewire_ohci 22532 0

crypto_blkcipher 18052 1 ecb

sdhci_pci 10624 0

pata_acpi 7680 0

8139too 24708 0

snd_mixer_oss 16896 1 snd_pcm_oss

i915 86660 2

firewire_core 35616 1 firewire_ohci

video 20240 0

sdhci 17540 1 sdhci_pci

iwl3945 129756 0

output 6528 1 video

mii 8192 2 8139cp,8139too

mmc_core 43676 1 sdhci

ricoh_mmc 7552 0

rfkill 11288 2 iwl3945

ata_piix 24836 0

snd_pcm 64772 2 snd_hda_intel,snd_pcm_oss

crc_itu_t 5760 1 firewire_core

wmi 9640 0

drm 146404 3 i915

iTCO_wdt 13732 0

mac80211 173668 1 iwl3945

ata_generic 8452 0

i2c_i801 12048 0

i2c_algo_bit 8836 1 i915

iTCO_vendor_support 6916 1 iTCO_wdt

btusb 14360 2

snd_timer 21896 2 snd_seq,snd_pcm

i2c_core 21396 4 i915,drm,i2c_i801,i2c_algo_bit

joydev 12736 0

pcspkr 6272 0

bluetooth 48608 8 bnep,rfcomm,l2cap,btusb

serio_raw 8836 0

snd_page_alloc 11144 2 snd_hda_intel,snd_pcm

cfg80211 23816 2 iwl3945,mac80211

snd_hwdep 10372 1 snd_hda_intel

snd 51768 18 snd_hda_intel,snd_seq_dummy,snd_seq_oss,snd_seq,snd_seq_device,snd_pcm_oss,snd_mixer_o
ss,snd_pcm,snd_timer,snd_hwdep

soundcore 9416 1 snd

sg 31028 0

dm_snapshot 19364 0

dm_zero 5632 0

dm_mirror 19968 0

dm_log 12164 1 dm_mirror

dm_mod 48692 10 dm_multipath,dm_snapshot,dm_zero,dm_mirror,dm_log

ahci 30604 2

libata 134892 4 pata_acpi,ata_piix,ata_generic,ahci

sd_mod 32408 5

scsi_mod 123772 6 usb_storage,scsi_dh,sr_mod,sg,libata,sd_mod

crc_t10dif 5632 1 sd_mod

ext3 109192 2

jbd 43284 1 ext3

mbcache 10244 1 ext3

uhci_hcd 23312 0

ohci_hcd 24336 0

ehci_hcd 32780 0

[root@msmunir1 ~]#



5. Create a folder on /media/remote directory.

Code :

# cd /media

# mkdir -p remote

Example :

[root@msmunir1 ~]# cd /media

[root@msmunir1 media]# mkdir -p remote


6. Run SSHFS to mount remote folder

Code :

# sshfs msmunir@202.46.3.71:/home/msmunir /media/remote


Example :

[root@msmunir1 media]# sshfs msmunir@202.46.3.71:/home/msmunir /media/remote

msmunir@202.46.3.71's password:

[root@msmunir1 media]#


7. Test your new folder

Code :

# df -h


Example :

[root@msmunir1 media]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/VolGroup00-LogVol00

54G 22G 30G 43% /

/dev/sda1 190M 19M 162M 11% /boot

tmpfs 247M 60K 247M 1% /dev/shm

/dev/sdb1 7,5G 4,6G 3,0G 61% /media/MSMUNIR8

msmunir@202.46.3.71:/home/msmunir

1000G 0 1000G 0% /media/remote

[root@msmunir1 media]#


Right now, you have new folder, /media/remote, where the content this folder is equal with the content of /home/msmunir folder on remote computer. This condition is very helpfull when you want to edit HTML or PHP script with gEdit.
by. msmunir@batan.go.id

No comments:

Post a Comment