How to mount a remote directory with SSHTags: sshserver server Linux Network2011-06-24 10:05 2979 People read comments (0) favorite reports
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
When we need to manage a remote Linux server, we often use the more secure SSH. Here is a method for mounting a remote directory using SSHFS.
When you're ready to start, open a mid-end 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 the remote directory: mkdir ~/home-server
3. SSHFS [Email Protected]:/path/to/your/dir ~/home-server
4. Use Umount ~/home-server when uninstalling
Using SSHFS to mount the hosts around the world on your computer can be a bit of a grandstanding, because this goal must have an important premise that you have to have a legitimate login for the remote host and that the host provides SSH access, which narrows it down a lot.
How is it done? Follow me!
1. Why do you do this and the benefits of doing so?
Oh! This question? MM ...., so to speak: what do you think of the remote host file that is as simple and straightforward as it is to your own hard drive? In fact, it is in front of you a partition, a directory, a hard disk! How cool is that? That is the benefit of it.
Mount to a local remote host directory
2. How do I get started?
You must establish 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 attached to this directory, in order to achieve the remote host file system simple access and operation.
3. Installing the Software
sudo apt-get install sshfs fusemount
4. Instance Operations
In this example, we need to mount the "/home" on the remote host "192.168.1.218" to the "/mnt/server218" of the local system, we 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 permissions:
sudo mkdir /mnt/server218
sudo chmod 777 /mnt/server218
Start Mount:
sshfs [email protected]:/home/ /mnt/server218/
sshfs 用户名@远程主机IP:远程主机路径 本地挂载点 ##用法解释
Enter the password of the human account of the 218 host at the prompt, mount the success!
Now open the local/mnt/server218 and see, oh,yeah!. That is the home directory of the 218 host, now you can create new, copy, paste, delete files under the directory. And so on all sorts of operations, just like your own hard drive!
Unloading:
fusemount -u mount_point
fusemount -u 本地挂载目录 #卸载命令
5. Follow-up questions:
The above operation (in addition to installing software) is in the ordinary user non-sudo environment to use, 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 identify 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 be met, compared to its powerful function, or acceptable, is so-called leisure not to hide the yoga.
How to mount a remote directory with SSH