SSH File System with offline access to cached files.
Project description
sshfs-offline
sshfs-offline is a Linux or macOS network filesystem.
sshfs-offline is a network filesystem that gives your computer direct access to your files on a remote server. sshfs-offline allows you to use files on your remote server as if they were files on your local computer. text sshfs-offline performs an on-demand download of files when your computer attempts to use them.
Key features
sshfs-offline has several nice features:
-
Only download files when you use them. The deafult is to only download a file if you (or a program on your computer) uses that file.
-
Bidirectional sync. sshfs-offline will only download a file when you access a file that has been changed remotely. If you somehow simultaneously modify a file both locally on your computer and also remotely on your server, sshfs-offline will keep the most recently modified file. The default is to check your remote server once every minute for any remotely changed files.
-
Can be used offline. Files you've opened previously will be available even if your computer has no access to the internet. While your computer is disconnected from the internet, you can continue to update the local filesystem and when you reconnect to the internet, the locally updated files will be uploaded to your server.
-
Fast. sshfs-offline asynchronously performs network requests to your server once every 10 seconds. sshfs-offline caches both filesystem metadata and file contents both in memory and on-disk. Filesytem operations will always be fast unless a large file must be read from Google Drive.
-
gitignore files. Files that match a
.gitignorefile are only cached locally and are not uploaded to your server. This means that Python virtual environment packages in.venvand nodejs packages innode_modulesare only installed locally.
Local Only directories. Directories can be configued to only store files locally in your native filesystem to improve small file performance. The ~/.sshfs-offline/<host>/config.toml file is used to configure local only directories. Thenode_modules directory is configured as a local only directory so node packages are stored locally in your native filesystem, and npm install will run very fast.
This is the default `config.toml' file:
### This is the configuration file.
### It should be placed in $HOME/.sshfs-offline/<host>/config.toml
# Directory names that are only created localy and not synced to Google Drive.
# Files in local only directories are stored in the native filessystem for fast
# updates. Install directories are good candidates to be stored locally.
local_only = [
"node_modules",
]
Quick start
Install FUSE
OSX
On Mac OSX, sshfs-offline requires osxfuse and pkg-config:
$ brew update; brew install pkg-config; brew tap homebrew/cask; brew install --cask osxfuse
Ubuntu / Debian
On Ubuntu / Debian, sshfs-offline requires libfuse-dev, libssl-dev and pkg-config:
sudo apt-get install -y fuse3 libfuse-dev libssl-dev pkg-config
Fedora
On Fedora, sshfs-offline requires gcc, fuse3-devel, and pkg-config:
sudo dnf install -y gcc fuse3-devel pkg-config
Authentication
SSH keys or password authentication are supported.
Install sshfs-offline:
MacOS
Install pipx:
brew install pipx
pipx ensurepath
sudo pipx ensurepath --global # optional to allow pipx actions with --global argument
pipx install sshfs-offline
Ubuntu / Debian
sudo apt update
sudo apt install pipx
pipx ensurepath
sudo pipx ensurepath --global # optional to allow pipx actions with --global argument
pipx install sshfs-offline
Fedora
sudo dnf install pipx
pipx ensurepath
sudo pipx ensurepath --global # optional to allow pipx actions with --global argument
pipx install sshfs-offline
Mount Filesystem
Create mountpoint directory:
MOUNTPOINT=~/mnt
mkdir $MOUNTPOINT
Mount Filesystem:
sshfs-offline mount $MOUNTPOINT --host <your hostname> # add --downloadall to sync all files
Notes:
- It's recommended to run it as user, not as root. For this to work the mountpoint must be owned by the user.
- The cache update interval defaults to 1 minutes, and can be set with the --updateinterval option.
Unmount Filesystem
sshfs-offline unmount $MOUNTPOINT --host <your hostname>
or
fusermount -u $MOUNTPOINT
Display sshfs-offline activity:
sshfs-offline status --host <your hostname>
Building sshfs-offline yourself
Create Virtual Environment:
cd sshfs-offline
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install -e .
Mount filesystem:
$ ./src/sshfs_offline/cli.py $MOUNTPOINT
Running tests
The best way to test is to clone a repo, and install, build and run the application.
Mount Filesystem:
sshfs-offline mount $MOUNTPOINT
Build and run web application:
cd $MOUNTPOINT
git clone https://github.com/allproxy/allproxy.git
npm install
npm run build
npm start
Run python application:
cd $MOUNTPOINT
git clone https://github.com/davechri/sshfs-offline.git
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install -e .
./src/sshfs_offline/cli.py status
Troubleshooting
If the filesystem appears to hang, its possible the fileystem has crashed. To resolve this:
- Remount:
fusermount -u $MOUNTPOINTand remountsshfs-offline mount $MOUNTPOINT --host <your hostname> - Clear the local cache:
fusermount -u $MOUNTPOINTand remountsshfs-offline mount $MOUNTPOINT --clearcache --host <your hostname> - Restart your computer
Logging
- Error Log: error logs are logged to
~/.sshfs-offline/error.log
Debug Logging
For debug logging use the --debug option. The --verbose option will produce more verbose logging.
sshfs-offline mount $MOUNTPOINT --host <your hostname> --debug &> ~/path_to_my_log_file
Display sshfs-offline status
Filesystem statistics are displayed every 10 seconds.
sshfs-offline status
08:28:45 ONLINE:
LOCAL_ONLY: /home/dave/.sshfs-offline/home/localonly=1.0 GB
REMOTE_FILES: dirs=526 files=934 links=17 cached=13.1 MB fileBytes=1.1 GB
08:28:57 ONLINE:
LOCAL_ONLY: /home/dave/.sshfs-offline/home/localonly=1.0 GB
REMOTE_FILES: dirs=526 files=934 links=17 cached=13.1 MB fileBytes=1.1 GB
08:29:09 ONLINE:
REMOTE CALLS: readdir=1
LOCAL_ONLY: /home/dave/.sshfs-offline/home/localonly=1.0 GB
REMOTE_FILES: dirs=564 files=941 links=20 cached=13.1 MB fileBytes=1.1 GB
Dump Internal State
Display metadata:
sshfs-offline metadata --host <your hostname>
Display directory entries:
sshfs-offline directories --host <your hostname>
Diaplay all unread files:
sshfs-offline unread --host <your hostname>
Display the event queue:
sshfs-offline eventqueue --host <your hostname>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sshfs_offline-0.0.9.tar.gz.
File metadata
- Download URL: sshfs_offline-0.0.9.tar.gz
- Upload date:
- Size: 46.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e14c3a019a851462f722f582ab5513babc532a8852fe007b6a8afb30ded511b3
|
|
| MD5 |
c997521604b3d10b1a0860e41ad8292e
|
|
| BLAKE2b-256 |
63caa647b6b921b9d6eae9cf285952dc7ab3e16c751ab54b4ec6e4dddb042f29
|
File details
Details for the file sshfs_offline-0.0.9-py3-none-any.whl.
File metadata
- Download URL: sshfs_offline-0.0.9-py3-none-any.whl
- Upload date:
- Size: 60.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf4d3414a15c081e8f4de0a3a655ab4d5573ac27bd3901dd1e523aa9c6e5bb29
|
|
| MD5 |
6f5a9f5796736f2a26e7ed6271854195
|
|
| BLAKE2b-256 |
c561a1a34c3ce8fac2ec9d84f5b55c2efdbb6dae98c1bca61c5db9fe0cb2ab2b
|