How to mount SFTP share in remote Linux machine

This could be implemented with  FUSE and SSHFS.

Download path:  http://fuse.sourceforge.net/sshfs.html

1. FUSE

package: fuse-2.8.5.tar.gz

Extract and install
#tar xvf fuse-2.8.5.tar.gz
#cd fuse-2.8.5
#./configure
#make
#make install

After successful installation,install SSHFS

2.SSHFS

package: sshfs-fuse-2.2.tar.gz

Extract and install
#tar xvf sshfs-fuse-2.2.tar.gz
#cd sshfs-fuse-2.2
#./configure
#make
#make install

Now we can use sshfs to mount sftp share.Before mounting,create mount point where the share to be mounted.
#mkdir /mnt/ftpshare

Mount command:  sshfs <username>@<ftpserver IP/host>:/<ftp_share_path> /<mountpoint>

Eg:
#sshfs testuser@192.168.1.2:/home/testuser /mnt/ftpshare/

This will prompt for password if user configured any password.

NOTE:  If you want to avoid prompting for password,then you should configure passwordless(key based) ssh login between these servers.(Assuming you are aware of how to configure it)

Verify the mounted partition using df command.

To mount this share directory in boot time,we need to add the following entry in /etc/fstab

sshfs#testuser@192.168.1.2:/home/testuser     /mnt/ftpshare          fuse                   defaults        0 0

NOTE:     For unmounting this partition,we can use fusermount command as below
#fusermount -u /mnt/ftpshare/


sshfs#10.0.0.2:/ 1000G 0 1000G 0% /mnt/test
VN:F [1.9.7_1111]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.7_1111]
Rating: 0 (from 0 votes)

Related Posts

  • No Related Post
Related Posts with Thumbnails

About the Author

CoreTimer

has written 31 stories on this site.

System administrator(Linux/UNIX/Windows) RHCE,MCP,CCNA

Write a Comment

Copyright © 2012 CoreTimer.com|System Admin’s Reference. All rights reserved.

Switch to our mobile site