How to mount a remote directory with SSH

Source: Internet
Author: User
Tags mkdir ssh access

When we need to manage a remote Linux server, we often use a more secure ssh. This provides a way to mount a remote directory using SSHFS.
When you're ready to start, open one of the mid-tier and follow the steps below:
1, sudo apt-get install SSHFS

2, sudo modprobe fuse

3, sudo adduser <username> fuse

4, sudo chown root:fuse/dev/fuse

5, sudo chmod +x/dev/fusermount 6, mkdir ~/remoteserv

7, SSHFS <username>@<ipaddress>:/remotepath ~/remoteserv

1. sudo apt-get install SSHFS

2. Create a new folder to mount a remote directory: mkdir ~/home-server

3. SSHFS Yourname@remote-host:/path/to/your/dir ~/home-server

4. Use Umount ~/home-server when unloading





Using SSHFS to mount the world's hosts to your computer may be a bit of a grandstanding, because the goal must have an important premise, you must have a remote host legitimate login account and the host provides SSH access, so the scope is reduced a lot.

How to do it. Follow me.

1. Why to do this and the benefits of doing so.

Oh. This problem. MM ..., so to speak: if you can operate on a remote host file as simply as you would on your own hard drive, what do you think? In fact, it is in front of you is a partition, a directory, a hard disk. It's so cool. That's the good thing about it.

Mount to a local remote host directory

2. How to get started.

You must set up the relevant mount point in the/mnt directory, simply to create a read-write directory, and use SSHFS to speak the remote host's hard disk, partition or directory mount to this directory, to achieve the remote host file system simple access and operation.

3. Installation software

sudo apt-get install SSHFS fusemount

4. Instance operation

In this instance, we need to mount the "/home" on the remote host "192.168.1.218" to the "/mnt/server218" of the local system, we already have all the necessary conditions before the mount: "192.168.1.218" account "human" and password, and 218 hosts provide SSH access.

Create a new directory "server218" and give it read and write access:

sudo mkdir/mnt/server218
sudo chmod 777/mnt/server218

Start Mount:

SSHFS human@192.168.1.218:/home//mnt/server218/
SSHFS User name @ remote host IP: Remote host path local mount point # #用法解释

At the prompt input 218 host human account password, Mount successfully.

Now open the local/mnt/server218 look, Oh,yeah. That is the home directory of the 218 hosts, now you can make the files under the directory to create new, copy, paste, delete ... And so on a variety of operations, like their own hard drive.

Unloading:

Fusemount-u Mount_point
Fusemount-u Local mount Directory #卸载命令

5. Follow-up questions:

All of the above (except for installing the software) are used by ordinary users in a non-sudo environment, very convenient, but I also found some problems in the use of the process, such as the remote host lost response after the local mount point card dead and affect the local system use, need to manually find the SSHFS process and kill, Due to the speed of the problem caused by slow operation and so on, but generally in a stable and fast network will not meet, compared to its powerful function, or acceptable, is the so-called leisure does not cover yoga.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.