美文网首页程序员
Mac 下ssh/sftp挂载远程文件夹

Mac 下ssh/sftp挂载远程文件夹

作者: ReadyShow | 来源:发表于2020-05-31 01:47 被阅读0次

准备工作

  1. 安装brew,就一行命令搞定,这里不多讲,可能需要科学上网才能搞定
  2. 解决brew慢的问题,使用国内镜像源
# 步骤一
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
 
# 步骤二
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
 
#步骤三
brew update
  1. 如果想复原brew
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
 
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core
 
brew update

正式安装

# 升级一下 homebrew
brew update
# 搜索 osxfuse
brew search osxfuse
# 安装 osxfuse
brew cask install osxfuse
# 搜索 sshfs
brew search sshfs
# 安装 sshfs
brew install sshfs
  1. 相关项目地址

开始使用

挂载

  1. 挂载远程主机要共享的目录,同时在本地将其命名为remoteDir
sshfs root@192.168.33.11:/ remoteDir

卸载

千万不能执行rm命令,小心删库
正确的做法是调用unmount,在mac os平台上,要利用diskutil来unmount

diskutil unmount remoteDir

相关文章

网友评论

    本文标题:Mac 下ssh/sftp挂载远程文件夹

    本文链接:https://www.haomeiwen.com/subject/bznkzhtx.html