我经常使用 sshfs 挂载远程驱动器。我很想自动拥有这个坐骑。但是,如果我在我的 .bashrc 或启动脚本中挂载它,挂载经常失败,因为我的无线互联网连接还没有建立。
有人知道每次建立连接时执行 bash 脚本或自动挂载 sshfs 驱动器的简单方法吗?
尝试连接到使用sshfsUbuntu (16.04 LTS)的远程主机时出现以下错误:
fuse: unknown option `defer_permissions'
Run Code Online (Sandbox Code Playgroud)
使用命令后:
sshfs -o allow_other,defer_permissions username@remotehost.com:/ /mnt/connected/
Run Code Online (Sandbox Code Playgroud)
去掉“defer_permissions”选项,命令执行成功,远程主机文件夹挂载到本地/mnt/connected/;但是,权限似乎不正确。
如果“defer_permissions”是一个未知选项,那么在挂载文件夹时应该使用什么选项来获得正确的权限sshfs?
设置一些 Ubuntu (13.04) 工作站,我试图安装一个远程文件系统(通过 ssh)。
我创建了用户someuser并将其添加到保险丝组
我的fstab条目如下:
sshfs#someuser@remote.com:/remote_dir /media/remote_dir/ fuse auto,_netdev,port=22,user,allow_other,noatime,follow_symlinks,IdentityFile=/home/someuser/.ssh/id_rsa,reconnect 0 0
Run Code Online (Sandbox Code Playgroud)根据我的理解:
在启动时,我使用someuser登录,启动终端,并且/media/remote_dir为空。
但是从同一个用户(或根),我可以只输入:
mount sshfs#someuser@remote.com:/remote_dir
Run Code Online (Sandbox Code Playgroud)
如果我在文件浏览器中单击remote_dir,它也会自动神奇地安装。
关于可能丢失什么的任何线索?
我有一个可以使用命令行连接的 SSHFS 挂载:
echo myPassword | sudo sshfs user@home.address:/ /media/NAS -p31337 -o workaround=rename -o password_stdin -o allow_other
Run Code Online (Sandbox Code Playgroud)
这似乎可以/media/NAS很好地安装我的 NAS 。
如果断电或互联网中断,连接偶尔会中断,在这些情况下,我必须认识到这种情况已经发生并使用相同的命令手动重新连接。
如果连接断开,有没有办法让我的 Ubuntu 服务器自动尝试重新连接,比如每 30 秒一次?
谢谢。
我正在尝试从 nautilus(由 sshfs 创建的目录)卸载,但出现此错误:
Unable to unmount dir
umount: /home/user/dir is not in the fstab (and you are not root)
Run Code Online (Sandbox Code Playgroud)
我不明白为什么会这样。如何在没有 sudo 的情况下卸载 sshfs?
任何启示将不胜感激。提前致谢,
是否有 GUI 实用程序可以通过 SSH (SSHFS) 挂载远程文件系统?
我正在尝试sftp使用sshfs以下命令将连接安装到文件夹中,该命令会引发错误。
~$ sshfs admin@example.com:/ testfo
remote host has disconnected
Run Code Online (Sandbox Code Playgroud)
如果我通过 SSH 进入系统并用 重复该命令,则会发生同样的错误localhost。此命令也适用于另一台机器,因此问题出在服务器上。
~$ cat /var/log/auth.log
[...]
May 24 22:49:43 example sshd[20095]: Accepted publickey for admin from 24.111.222.33 port 47086 ssh2: RSA ad:xx:6e:xx:14:xx:bd:b5:xx:cb:66:xx:xx:xx:a3:ac
May 24 22:49:43 example sshd[20095]: pam_unix(sshd:session): session opened for user admin by (uid=0)
May 24 22:49:43 example systemd-logind[812]: Removed session 60.
May 24 22:49:43 example systemd-logind[812]: New session 61 of user admin.
May 24 22:49:44 example sshd[20143]: Received disconnect from 24.203.164.45: …Run Code Online (Sandbox Code Playgroud) 所以我试图从局域网中的另一台计算机挂载一个文件夹,并且我能够毫无问题地进行 ssh。但是,当我访问安装的文件夹时,我无法进行任何更改。
这是我到目前为止所做的:
安装:
$sudo apt-get install sshfs
$sudo modprobe fuse
$sudo adduser <username> fuse
$sudo chown root:fuse /dev/fuse
$sudo chmod +x /dev/fuse
$mkdir ~/remoteserv
Run Code Online (Sandbox Code Playgroud)
当我通过 sshfs 访问远程文件夹时:
$sshfs -o idmap=user <username>@<ipaddress>:/home/user ~/remoteserv
Run Code Online (Sandbox Code Playgroud)
的输出变为:
$~/remoteserv$ ls -l
total 60
drwxr-xr-x 1 <notmyusername> <notmyusername> 4096 2012-04-13 21:54 Desktop
drwxr-xr-x 1 <notmyusername> <notmyusername> 4096 2012-04-10 13:05 Documents
drwxr-xr-x 1 <notmyusername> <notmyusername> 4096 2012-04-17 19:06 Downloads
drwxr-xr-x 1 <notmyusername> <notmyusername> 4096 2012-04-13 21:55 Music
drwxr-xr-x 1 <notmyusername> <notmyusername> 4096 2012-04-03 15:07 Pictures
... …Run Code Online (Sandbox Code Playgroud)