























目标:在 macOS 上通过 SSHFS 挂载集群代码目录,用本地 VS Code 编辑,不使用 Remote-SSH。
brew install --cask macfuse
安装后:
brew install gromgit/fuse/sshfs-mac
brew link --overwrite sshfs-mac
验证:
sshfs -V
mkdir -p ~/dfci_code
⚠️ 只挂载代码目录,不要挂整个 home。
例如远端目录:
/home/zz950/project_code
sshfs zz950@argos.dfci.harvard.edu:/home/zz950/project_code ~/dfci_code \
-o reconnect \
-o ServerAliveInterval=15 \
-o ServerAliveCountMax=3 \
-o follow_symlinks
验证:
ls ~/dfci_code
如果能看到远端文件,说明成功。
~/dfci_code此时:
编辑和执行分离。
在终端:
ssh zz950@argos.dfci.harvard.edu
或:
ssh zz950@argos.dfci.harvard.edu "bash run.sh"
推荐:
diskutil unmount ~/dfci_code
如果挂载卡住:
diskutil unmount force ~/dfci_code
只挂代码,例如:
project_code/
不要挂:
data/
results/
在 .vscode/settings.json 添加:
{
"files.watcherExclude": {
"**/data/**": true,
"**/results/**": true
}
}
避免扫描大量文件。
错误方式:
pd.read_csv("~/dfci_code/data/bigfile.csv")
正确方式:
在 ssh 登录的集群终端里运行数据处理。
SSHFS 只用于:
本地(Mac):
集群:
这种结构:
创建:
nano mount_dfci.sh
写入:
#!/bin/bash
sshfs zz950@argos.dfci.harvard.edu:/home/zz950/project_code ~/dfci_code \
-o reconnect \
-o ServerAliveInterval=15 \
-o ServerAliveCountMax=3 \
-o follow_symlinks
保存后:
chmod +x mount_dfci.sh
以后只需:
./mount_dfci.sh
这套结构在老系统科研集群上非常稳健。
最后,关机,进入恢复模式给权限。
在 Recovery 里正确路径是:
1. 退出 Disk Utility
2. 回到 Recovery 主界面
3. 菜单栏 → Utilities
4. Startup Security Utility
5. 选择你的系统磁盘
6. 点击 Security Policy
7. 选择:
✔ Reduced Security
✔ Allow user management of kernel extensions
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。