如何列出当前的 sshfs 挂载到服务器?

M. *_*ith 15 linux ssh logging sshfs

如果有人通过 ssh 登录服务器以使用 shell,可以快速使用 last|w|who 来显示登录用户。如果有人从另一台计算机通过 sshfs 在同一台服务器上挂载目录 last|w|who 不显示连接。是否有类似于 last|w|who 的命令可以显示服务器上的当前 sshfs 安装?

and*_*dol 18

进行 sshfs 挂载涉及跨 sftp 连接。因此,您可以做的是查找生成的 sftp 进程。假设用户 andreas 进行了 sshfs 挂载,或使用常规 sftp 登录,您将看到以下内容:

root@halleck:~# ps aux | grep -i sftp | grep -v grep
andreas  11029  0.0  0.0   2420   648 ?        Ss   23:56   0:00 /usr/lib/openssh/sftp-server
root@halleck:~#
Run Code Online (Sandbox Code Playgroud)

替代品

root@halleck:~# ps aux | grep -i sftp | grep -v grep
andreas  11091  0.0  0.1   9564  1116 ?        Ss   23:57   0:00 sshd: andreas@internal-sftp
root@halleck:~#
Run Code Online (Sandbox Code Playgroud)

您看到的内容取决于您配置的 sftp 子系统。

此答案中的详细信息假设 OpenSSH 服务器端。