From 1631a9f5a4c8078c824e70f5a777c551b2cf4f61 Mon Sep 17 00:00:00 2001 From: Gabriel Staples Date: Tue, 22 Dec 2020 20:28:15 -0800 Subject: [PATCH 01/15] rename README.rst --> README.md --- README.rst => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README.rst => README.md (100%) diff --git a/README.rst b/README.md similarity index 100% rename from README.rst rename to README.md From 006b1faf5450d0491d53fc31b768fd2a78088170 Mon Sep 17 00:00:00 2001 From: Gabriel Staples Date: Tue, 22 Dec 2020 20:53:02 -0800 Subject: [PATCH 02/15] Convert README.md from Restructured Text to Github Flavored Markdown (GFM) --- README.md | 54 +++++++++++++++++++++++++----------------------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 801846c4..7b937a05 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,14 @@ -SSHFS -===== +# SSHFS -About ------ +## About SSHFS allows you to mount a remote filesystem using SFTP. Most SSH servers support and enable this SFTP access by default, so SSHFS is very simple to use - there's nothing to do on the server-side. -Development Status ------------------- +## Development Status SSHFS is shipped by all major Linux distributions and has been in production use across a wide range of systems for many years. However, @@ -24,10 +21,9 @@ understand that unless you are including a pull request or are reporting a critical issue, you will probably not get a response. -How to use ----------- +## How to use -Once sshfs is installed (see next section) running it is very simple:: +Once sshfs is installed (see next section) running it is very simple: sshfs [user@]hostname:[directory] mountpoint @@ -40,57 +36,49 @@ which ask for the password if needed). Also many ssh options can be specified (see the manual pages for *sftp(1)* and *ssh_config(5)*), including the remote port number -(``-oport=PORT``) +(`-oport=PORT`) -To unmount the filesystem:: +To unmount the filesystem: fusermount -u mountpoint -On BSD and macOS, to unmount the filesystem:: +On BSD and macOS, to unmount the filesystem: umount mountpoint -Installation ------------- +## Installation First, download the latest SSHFS release from https://github.com/libfuse/sshfs/releases. On Linux and BSD, you will -also need to install libfuse_ 3.1.0 or newer. On macOS, you need -OSXFUSE_ instead. Finally, you need the Glib_ library with development +also need to install [libfuse][libfuse] 3.1.0 or newer. On macOS, you need +[OSXFUSE][OSXFUSE] instead. Finally, you need the [Glib][Glib] library with development headers (which should be available from your operating system's package manager). -To build and install, we recommend to use Meson_ (version 0.38 or -newer) and Ninja_. After extracting the sshfs tarball, create a -(temporary) build directory and run Meson:: +To build and install, we recommend to use [Meson][Meson] (version 0.38 or +newer) and [Ninja][Ninja]. After extracting the sshfs tarball, create a +(temporary) build directory and run Meson: $ mkdir build; cd build $ meson .. Normally, the default build options will work fine. If you nevertheless want to adjust them, you can do so with the *mesonconf* -command:: +command: $ mesonconf # list options $ mesonconf -D strip=true # set an option To build, test and install SSHFS, you then use Ninja (running the -tests requires the `py.test`_ Python module):: +tests requires the [`py.test`][py.test] Python module): $ ninja $ python3 -m pytest test/ # optional, but recommended $ sudo ninja install -.. _libfuse: http://github.com/libfuse/libfuse -.. _OSXFUSE: https://osxfuse.github.io/ -.. _Glib: https://developer.gnome.org/glib/stable/ -.. _Meson: http://mesonbuild.com/ -.. _Ninja: https://ninja-build.org/ -.. _`py.test`: http://www.pytest.org/ -Getting Help ------------- +## Getting Help If you need help, please ask on the mailing list (subscribe at @@ -98,3 +86,11 @@ https://lists.sourceforge.net/lists/listinfo/fuse-sshfs). Please report any bugs on the GitHub issue tracker at https://github.com/libfuse/libfuse/issues. + + + [libfuse]: http://github.com/libfuse/libfuse + [OSXFUSE]: https://osxfuse.github.io/ + [Glib]: https://developer.gnome.org/glib/stable/ + [Meson]: http://mesonbuild.com/ + [Ninja]: https://ninja-build.org/ + [py.test]: http://www.pytest.org/ From dc950df3508d3378d88d67d8e558b60c5e3496d8 Mon Sep 17 00:00:00 2001 From: Gabriel Staples Date: Tue, 22 Dec 2020 21:26:43 -0800 Subject: [PATCH 03/15] README.md: fix up all parts except for "Installation" section --- README.md | 130 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 78 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 7b937a05..98b2e460 100644 --- a/README.md +++ b/README.md @@ -3,88 +3,114 @@ ## About -SSHFS allows you to mount a remote filesystem using SFTP. Most SSH -servers support and enable this SFTP access by default, so SSHFS is -very simple to use - there's nothing to do on the server-side. +SSHFS allows you to mount a remote filesystem using SFTP. Most SSH servers support and enable this +SFTP access by default, so SSHFS is very simple to use--there's nothing to do on the server-side. ## Development Status -SSHFS is shipped by all major Linux distributions and has been in -production use across a wide range of systems for many years. However, -at present SSHFS does not have any active, regular contributors, and -there are a number of known issues (see the bugtracker). The current -maintainer continues to apply pull requests and makes regular -releases, but unfortunately has no capacity to do any development -beyond addressing high-impact issues. When reporting bugs, please -understand that unless you are including a pull request or are -reporting a critical issue, you will probably not get a response. +SSHFS is shipped by all major Linux distributions and has been in production use across a wide range +of systems for many years. However, at present SSHFS does not have any active, regular contributors, +and there are a number of known issues (see all issues and bugs in the [issue tracker](issues)). The +current maintainer continues to apply pull requests and makes regular releases, but unfortunately +has no capacity to do any development beyond addressing high-impact issues. _When reporting bugs, +please understand that unless you are including a pull request or are reporting a critical issue, +you will probably not get a response._ ## How to use -Once sshfs is installed (see next section) running it is very simple: +Once `sshfs` is installed (see the "[Installation](#installation)" section below) running it is very +simple. - sshfs [user@]hostname:[directory] mountpoint +### 1. To mount a remote filesystem with `sshfs`: -It is recommended to run SSHFS as regular user (not as root). For -this to work the mountpoint must be owned by the user. If username is -omitted SSHFS will use the local username. If the directory is -omitted, SSHFS will mount the (remote) home directory. If you need to -enter a password sshfs will ask for it (actually it just runs ssh -which ask for the password if needed). +General command syntax: +```bash +sshfs [user@]hostname_or_ip:[directory] mountpoint +``` -Also many ssh options can be specified (see the manual pages for -*sftp(1)* and *ssh_config(5)*), including the remote port number -(`-oport=PORT`) +For example, to connect to the username "john" on a host at local IP `10.0.0.1`, mounting the host's +root directory (`/`) in your local `~/mnt/sshfs` directory, you would do the following: -To unmount the filesystem: +```bash +mkdir -p ~/mnt/sshfs +sshfs john@10.0.0.1:/ ~/mnt/sshfs +``` - fusermount -u mountpoint +### 2. To unmount the remote filesystem: -On BSD and macOS, to unmount the filesystem: +General syntax: +```bash +# For most systems, including Ubuntu +fusermount -u mountpoint - umount mountpoint +# For BSD and MacOS, and also works fine on Ubuntu +umount mountpoint +``` + +For the example above: +```bash +# For most systems, including Ubuntu +fusermount -u ~/mnt/sshfs + +# For BSD and MacOS, and also works fine on Ubuntu +umount ~/mnt/sshfs +``` + +### 3. Notes: +1. It is recommended to run SSHFS as a regular user (NOT as root). For this to work, the mount point + must be owned by the user. Therefore, mounting into a `mount` or `mnt` directory you create + inside your home directory is a good practice. +1. If the username is omitted, SSHFS will use the local username. +1. If the directory is omitted, SSHFS will mount the (remote) home directory. +1. If you need to enter a password, SSHFS will ask for it (actually, it just runs `ssh` which asks + for the password if needed). + +Also, many `ssh` options can be specified. See the manual pages for _sftp(1)_ (`man 1 sftp`) and +_ssh_config(5)_ (`man 5 ssh_config`). The remote port number (`-oport=PORT`) is one of the many +`ssh` options which works with `sshfs`. ## Installation -First, download the latest SSHFS release from -https://github.com/libfuse/sshfs/releases. On Linux and BSD, you will -also need to install [libfuse][libfuse] 3.1.0 or newer. On macOS, you need -[OSXFUSE][OSXFUSE] instead. Finally, you need the [Glib][Glib] library with development -headers (which should be available from your operating system's -package manager). +First, download the latest SSHFS release from https://github.com/libfuse/sshfs/releases. On Linux +and BSD, you will also need to install [libfuse][libfuse] 3.1.0 or newer. On macOS, you need +[OSXFUSE][OSXFUSE] instead. Finally, you need the [Glib][Glib] library with development headers +(which should be available from your operating system's package manager). -To build and install, we recommend to use [Meson][Meson] (version 0.38 or -newer) and [Ninja][Ninja]. After extracting the sshfs tarball, create a -(temporary) build directory and run Meson: +To build and install, we recommend to use [Meson][Meson] (version 0.38 or newer) and [Ninja][Ninja]. + After extracting the sshfs tarball, create a (temporary) build directory and run Meson: - $ mkdir build; cd build - $ meson .. +```bash +mkdir build; cd build +meson .. +``` -Normally, the default build options will work fine. If you -nevertheless want to adjust them, you can do so with the *mesonconf* -command: +Normally, the default build options will work fine. If you nevertheless want to adjust them, you can +do so with the *mesonconf* command: - $ mesonconf # list options - $ mesonconf -D strip=true # set an option +```bash +mesonconf # list options +mesonconf -D strip=true # set an option +``` -To build, test and install SSHFS, you then use Ninja (running the -tests requires the [`py.test`][py.test] Python module): +To build, test and install SSHFS, you then use Ninja (running the tests requires the +[`py.test`][py.test] Python module): - $ ninja - $ python3 -m pytest test/ # optional, but recommended - $ sudo ninja install +```bash +ninja +python3 -m pytest test/ # optional, but recommended +sudo ninja install +``` ## Getting Help -If you need help, please ask on the -mailing list (subscribe at -https://lists.sourceforge.net/lists/listinfo/fuse-sshfs). +If you need help, please ask on the mailing list. Subscribe at +https://lists.sourceforge.net/lists/listinfo/fuse-sshfs. -Please report any bugs on the GitHub issue tracker at +Please report any `libfuse`-related bugs on the GitHub issue tracker at https://github.com/libfuse/libfuse/issues. From 3a7bc12a631f8a8f97f609fc38c5b5eec25bbad8 Mon Sep 17 00:00:00 2001 From: Gabriel Staples Date: Tue, 22 Dec 2020 21:33:12 -0800 Subject: [PATCH 04/15] Update README --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 98b2e460..06b20ddb 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ ## About +SSHFS is part of the [libfuse](https://github.com/libfuse) project. + SSHFS allows you to mount a remote filesystem using SFTP. Most SSH servers support and enable this SFTP access by default, so SSHFS is very simple to use--there's nothing to do on the server-side. @@ -11,11 +13,11 @@ SFTP access by default, so SSHFS is very simple to use--there's nothing to do on SSHFS is shipped by all major Linux distributions and has been in production use across a wide range of systems for many years. However, at present SSHFS does not have any active, regular contributors, -and there are a number of known issues (see all issues and bugs in the [issue tracker](issues)). The -current maintainer continues to apply pull requests and makes regular releases, but unfortunately -has no capacity to do any development beyond addressing high-impact issues. _When reporting bugs, -please understand that unless you are including a pull request or are reporting a critical issue, -you will probably not get a response._ +and there are a number of known issues (see all issues and bugs in the [SSHFS issue +tracker](issues)). The current maintainer continues to apply pull requests and makes regular +releases, but unfortunately has no capacity to do any development beyond addressing high-impact +issues. _When reporting bugs, please understand that unless you are including a pull request or are +reporting a critical issue, you will probably not get a response._ ## How to use @@ -34,7 +36,7 @@ For example, to connect to the username "john" on a host at local IP `10.0.0.1`, root directory (`/`) in your local `~/mnt/sshfs` directory, you would do the following: ```bash -mkdir -p ~/mnt/sshfs +mkdir -p ~/mnt/sshfs # create the ~/mnt/sshfs directory, if it doesn't already exist sshfs john@10.0.0.1:/ ~/mnt/sshfs ``` @@ -110,7 +112,7 @@ sudo ninja install If you need help, please ask on the mailing list. Subscribe at https://lists.sourceforge.net/lists/listinfo/fuse-sshfs. -Please report any `libfuse`-related bugs on the GitHub issue tracker at +Please report any bugs on the GitHub issue tracker for the main parent project (`libfuse`) at https://github.com/libfuse/libfuse/issues. From f594fc2ff994b81d2e7c15230b6f0df702b57090 Mon Sep 17 00:00:00 2001 From: Gabriel Staples Date: Tue, 22 Dec 2020 21:36:43 -0800 Subject: [PATCH 05/15] README.md: fix links --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 06b20ddb..780b0197 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,10 @@ SFTP access by default, so SSHFS is very simple to use--there's nothing to do on SSHFS is shipped by all major Linux distributions and has been in production use across a wide range of systems for many years. However, at present SSHFS does not have any active, regular contributors, and there are a number of known issues (see all issues and bugs in the [SSHFS issue -tracker](issues)). The current maintainer continues to apply pull requests and makes regular -releases, but unfortunately has no capacity to do any development beyond addressing high-impact -issues. _When reporting bugs, please understand that unless you are including a pull request or are -reporting a critical issue, you will probably not get a response._ +tracker](https://github.com/libfuse/sshfs/issues)). The current maintainer continues to apply pull +requests and makes regular releases, but unfortunately has no capacity to do any development beyond +addressing high-impact issues. _When reporting bugs, please understand that unless you are including +a pull request or are reporting a critical issue, you will probably not get a response._ ## How to use @@ -112,7 +112,7 @@ sudo ninja install If you need help, please ask on the mailing list. Subscribe at https://lists.sourceforge.net/lists/listinfo/fuse-sshfs. -Please report any bugs on the GitHub issue tracker for the main parent project (`libfuse`) at +Please report any bugs on the main parent project's (`libfuse`'s) GitHub issue tracker here: https://github.com/libfuse/libfuse/issues. From ca7d6950d93a15dd0bc2a12be1fa62cf5dd87c38 Mon Sep 17 00:00:00 2001 From: Gabriel Staples Date: Tue, 22 Dec 2020 22:47:09 -0800 Subject: [PATCH 06/15] README.md: wip: rewriting build and install instructions --- README.md | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 780b0197..f23fdb21 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ a pull request or are reporting a critical issue, you will probably not get a re ## How to use -Once `sshfs` is installed (see the "[Installation](#installation)" section below) running it is very +Once `sshfs` is installed (see the "[Build and Install](#build)" section below) running it is very simple. ### 1. To mount a remote filesystem with `sshfs`: @@ -74,7 +74,67 @@ _ssh_config(5)_ (`man 5 ssh_config`). The remote port number (`-oport=PORT`) is `ssh` options which works with `sshfs`. -## Installation + +## Build and Install + +Tested 22 Dec. 2020 on Ubuntu 20.04. + +1. Download and `cd` into the source code + 1. To download the latest source code: + ```bash + git clone https://github.com/libfuse/sshfs.git + cd sshfs + ``` + 1. OR (recommended): To download the latest `sshfs` _release_: + 1. Find the release you want here: https://github.com/libfuse/sshfs/releases. + 1. Find the link to the `*.tar.gz` file you want. Example: https://github.com/libfuse/sshfs/archive/sshfs-3.7.1.tar.gz. + 1. Download, extract, and `cd` into it: + ```bash + wget https://github.com/libfuse/sshfs/archive/sshfs-3.7.1.tar.gz + tar -xvzf sshfs-3.7.1.tar.gz + cd sshfs-sshfs-3.7.1 + ``` +1. Install dependencies + ```bash + sudo apt update + sudo apt install meson cmake fuse3 libfuse3-dev libglib2.0-dev + ``` +1. Create a **build** dir, `cd` into it, run `meson`, and build and link with `ninja`: + ```bash + mkdir build + cd build + meson .. + ninja # this builds and produces the new `sshfs` executable + ``` + + +1. (Optional, but recommended) test your new `sshfs` executable. + 1. Note: ssh key generation notes come [from GitHub here](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent). + ```bash + # install the `pytest` python3 module in case you don't already have it + pip3 install pytest + # install `sshd` + sudo apt update + sudo apt install openssh-server + + # Configure passwordless ssh key-based login so you can ssh into yourself + # (via `localhost`) for testing; see GitHub link above. + # 1. Generate a new public-private key pair. + ssh-keygen -t ed25519 -C "your_email@example.com" + eval "$(ssh-agent -s)" + ssh-add ~/.ssh/id_ed25519 + # 2. Now add your new "~/.ssh/id_ed25519.pub" public key to your + # "~/.ssh/authorized_keys" file so you can have key-based password-less + # ssh sessions into yourself via `localhost` for testing. + cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys + + # run the python3 tests in the "test" dir + python3 -m pytest test/ + ``` +1. + + First, download the latest SSHFS release from https://github.com/libfuse/sshfs/releases. On Linux and BSD, you will also need to install [libfuse][libfuse] 3.1.0 or newer. On macOS, you need From 865c92f40ec293dfbef8c3cf8ac48ac133d59288 Mon Sep 17 00:00:00 2001 From: Gabriel Staples Date: Tue, 22 Dec 2020 23:15:15 -0800 Subject: [PATCH 07/15] Finish build and install notes in README.md; fix error msg in test_sshfs.py --- README.md | 100 ++++++++++++++++++++++++++++++--------------- test/test_sshfs.py | 17 ++++---- 2 files changed, 76 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index f23fdb21..a1d81e52 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,11 @@ a pull request or are reporting a critical issue, you will probably not get a re Once `sshfs` is installed (see the "[Build and Install](#build)" section below) running it is very simple. +```bash +sshfs -h # help menu +sshfs --version # see version +``` + ### 1. To mount a remote filesystem with `sshfs`: General command syntax: @@ -77,7 +82,44 @@ _ssh_config(5)_ (`man 5 ssh_config`). The remote port number (`-oport=PORT`) is ## Build and Install -Tested 22 Dec. 2020 on Ubuntu 20.04. +### 1. General overview + +First, download the latest SSHFS release from https://github.com/libfuse/sshfs/releases. On Linux +and BSD (as opposed to MacOS), you will also need to install [libfuse][libfuse] 3.1.0 or newer. On +MacOS, you need [OSXFUSE][OSXFUSE] instead. Finally, you need the [Glib][Glib] library with +development headers, which should be available from your operating system's package manager. + +To build and install, we recommend you use [Meson][Meson] (version 0.38 or newer) and +[Ninja][Ninja]. After extracting the `sshfs` tarball, create a (temporary) build directory and run +Meson: + +```bash +mkdir build; cd build +meson .. +``` + +Normally, the default build options will work fine. If you nevertheless want to adjust them, you can +do so with the `meson configure` command: + +```bash +meson configure # list options +meson configure -D strip=true # set an option +``` + +To build, test and install SSHFS, you then use Ninja. Running the tests requires the +[`py.test`][py.test] Python module. It also requires configuring ssh keys for passwordless login to +yourself via _localhost_. See the [detailed notes about ssh key generation and setup](#sshkeygen) +below. + +```bash +ninja +python3 -m pytest test/ # (Optional, but recommended) run the tests +sudo ninja install +``` + +### 2. Detailed instructions + +_Tested 22 Dec. 2020 on Ubuntu 20.04._ 1. Download and `cd` into the source code 1. To download the latest source code: @@ -132,39 +174,29 @@ change it there too. --> # run the python3 tests in the "test" dir python3 -m pytest test/ ``` -1. - - - -First, download the latest SSHFS release from https://github.com/libfuse/sshfs/releases. On Linux -and BSD, you will also need to install [libfuse][libfuse] 3.1.0 or newer. On macOS, you need -[OSXFUSE][OSXFUSE] instead. Finally, you need the [Glib][Glib] library with development headers -(which should be available from your operating system's package manager). - -To build and install, we recommend to use [Meson][Meson] (version 0.38 or newer) and [Ninja][Ninja]. - After extracting the sshfs tarball, create a (temporary) build directory and run Meson: - -```bash -mkdir build; cd build -meson .. -``` - -Normally, the default build options will work fine. If you nevertheless want to adjust them, you can -do so with the *mesonconf* command: - -```bash -mesonconf # list options -mesonconf -D strip=true # set an option -``` - -To build, test and install SSHFS, you then use Ninja (running the tests requires the -[`py.test`][py.test] Python module): - -```bash -ninja -python3 -m pytest test/ # optional, but recommended -sudo ninja install -``` +1. Install `sshfs`: + 1. Normal method: + ```bash + sudo ninja install + ``` + 1. "Light" method. This technique simply creates a symlink to the executable in your `~/bin` + dir so your Linux distro's install still remain's intact and untouched. (For Ubuntu). + ```bash + # "Install" via a symlink. Note: ensure you are in the same dir as the new `sshfs` + # executable first. + mkdir -p ~/bin + ln -si "$(pwd)/sshfs ~/bin" + . ~/.bashrc # re-source your .bashrc file to bring the ~/bin dir into your PATH + + # To "Uninstall" + rm ~/bin/sshfs + . ~/.bashrc + ``` +1. Check your version from another dir to ensure the installation worked correctly. + ```bash + cd ~ + sshfs --version + ``` ## Getting Help diff --git a/test/test_sshfs.py b/test/test_sshfs.py index 71cbd7ff..e491ebd1 100755 --- a/test/test_sshfs.py +++ b/test/test_sshfs.py @@ -35,15 +35,15 @@ def name_generator(__ctr=[0]): @pytest.mark.parametrize("sync_rd", (True, False)) @pytest.mark.parametrize("multiconn", (True,False)) def test_sshfs(tmpdir, debug, cache_timeout, sync_rd, multiconn, capfd): - + # Avoid false positives from debug messages #if debug: # capfd.register_output(r'^ unique: [0-9]+, error: -[0-9]+ .+$', # count=0) - # Avoid false positives from storing key for localhost + # Avoid false positives from storing key for localhost capfd.register_output(r"^Warning: Permanently added 'localhost' .+", count=0) - + # Test if we can ssh into localhost without password try: res = subprocess.call(['ssh', '-o', 'KbdInteractiveAuthentication=no', @@ -54,7 +54,10 @@ def test_sshfs(tmpdir, debug, cache_timeout, sync_rd, multiconn, capfd): except subprocess.TimeoutExpired: res = 1 if res != 0: - pytest.fail('Unable to ssh into localhost without password prompt.') + pytest.fail('Unable to ssh into localhost without password prompt. Ensure you have ' + + '`sshd` installed (ex: in Ubuntu: `sudo apt install openssh-server`) and that you ' + + 'have followed all instructions to configure password-less ssh sessions into ' + + 'yourself via `localhost`. See here: https://github.com/libfuse/sshfs#sshkeygen.') mnt_dir = str(tmpdir.mkdir('mnt')) src_dir = str(tmpdir.mkdir('src')) @@ -80,12 +83,12 @@ def test_sshfs(tmpdir, debug, cache_timeout, sync_rd, multiconn, capfd): if multiconn: cmdline += [ '-o', 'max_conns=3' ] - + new_env = dict(os.environ) # copy, don't modify # Abort on warnings from glib new_env['G_DEBUG'] = 'fatal-warnings' - + mount_process = subprocess.Popen(cmdline, env=new_env) try: wait_for_mount(mount_process, mnt_dir) @@ -299,7 +302,7 @@ def tst_link(mnt_dir, cache_timeout): # we need to wait until the cached value has expired. if cache_timeout: safe_sleep(cache_timeout) - + fstat1 = os.lstat(name1) fstat2 = os.lstat(name2) for attr in ('st_mode', 'st_dev', 'st_uid', 'st_gid', From 954fc377d3594b14ba238bec0c93cc463a4041f8 Mon Sep 17 00:00:00 2001 From: Gabriel Staples Date: Tue, 22 Dec 2020 23:20:11 -0800 Subject: [PATCH 08/15] README.md: update keygen notes & version output --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a1d81e52..37518e07 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,8 @@ _Tested 22 Dec. 2020 on Ubuntu 20.04._ -1. (Optional, but recommended) test your new `sshfs` executable. +1. (Optional, but recommended) test your new `sshfs` executable. [This also includes detailed notes + about ssh key generation and setup]. 1. Note: ssh key generation notes come [from GitHub here](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent). ```bash # install the `pytest` python3 module in case you don't already have it @@ -195,7 +196,14 @@ change it there too. --> 1. Check your version from another dir to ensure the installation worked correctly. ```bash cd ~ - sshfs --version + sshfs --version + ``` + Sample version output: + ``` + SSHFS version 3.7.1 + FUSE library version 3.9.0 + using FUSE kernel interface version 7.31 + fusermount3 version: 3.9.0 ``` From bb51c783434483623125ffdb35da84bad44a9024 Mon Sep 17 00:00:00 2001 From: Gabriel Staples Date: Tue, 22 Dec 2020 23:26:23 -0800 Subject: [PATCH 09/15] Update README --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 37518e07..f844c3d7 100644 --- a/README.md +++ b/README.md @@ -191,7 +191,6 @@ change it there too. --> # To "Uninstall" rm ~/bin/sshfs - . ~/.bashrc ``` 1. Check your version from another dir to ensure the installation worked correctly. ```bash From a1d58ae1be99571a88b8439b027abe6349b74658 Mon Sep 17 00:00:00 2001 From: Gabriel Staples Date: Tue, 22 Dec 2020 23:26:40 -0800 Subject: [PATCH 10/15] Fix deprecated warning in conftest.py ``` test/conftest.py:66 sshfs/build/test/conftest.py:66: PytestDeprecationWarning: @pytest.yield_fixture is deprecated. Use @pytest.fixture instead; they are the same. @pytest.yield_fixture(autouse=True) ``` --- test/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/conftest.py b/test/conftest.py index 70cd0c62..d58d45b2 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -63,7 +63,7 @@ def register_output(self, pattern, count=1, flags=re.MULTILINE): # relies on tests running sequential (i.e., don't dare to use e.g. the xdist # plugin) current_capfd = None -@pytest.yield_fixture(autouse=True) +@pytest.fixture(autouse=True) def save_cap_fixtures(request, capfd): global current_capfd capfd.false_positives = [] From 03ee1f8aa0899268ec02b2f54849352df92a3a1d Mon Sep 17 00:00:00 2001 From: Gabriel Staples Date: Tue, 22 Dec 2020 23:33:55 -0800 Subject: [PATCH 11/15] pytest.ini: fix test warning Warning: ``` test/util.py:99 sshfs/build/test/util.py:99: PytestUnknownMarkWarning: Unknown pytest.mark.uses_fuse - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html return pytest.mark.uses_fuse() ``` References for the fix: 1. https://stackoverflow.com/questions/60806473/pytestunknownmarkwarning-unknown-pytest-mark-xxx-is-this-a-typo/60813297#60813297 1. https://docs.pytest.org/en/stable/mark.html --- test/pytest.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/pytest.ini b/test/pytest.ini index 95161546..7a7efed4 100644 --- a/test/pytest.ini +++ b/test/pytest.ini @@ -1,2 +1,4 @@ [pytest] addopts = --verbose --assert=rewrite --tb=native -x -r a +markers = + uses_fuse From 56b67639b5fe69164c92e6de70649f955eecb005 Mon Sep 17 00:00:00 2001 From: Gabriel Staples Date: Tue, 22 Dec 2020 23:43:47 -0800 Subject: [PATCH 12/15] Add sample test output Changes to be committed: modified: ../README.md new file: ../test/README.md --- README.md | 1 + test/README.md | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 test/README.md diff --git a/README.md b/README.md index f844c3d7..e60ef753 100644 --- a/README.md +++ b/README.md @@ -175,6 +175,7 @@ change it there too. --> # run the python3 tests in the "test" dir python3 -m pytest test/ ``` + For [sample test output, see here](test/README.md). 1. Install `sshfs`: 1. Normal method: ```bash diff --git a/test/README.md b/test/README.md new file mode 100644 index 00000000..0d9e04a9 --- /dev/null +++ b/test/README.md @@ -0,0 +1,32 @@ + +To set up and run the tests, see the [detailed instructions here](../README.md#sshkeygen). + +Sample test output: + +```bash +~/GS/dev/sshfs/src/sshfs/build$ python3 -m pytest test/ +============================================================================================ test session starts ============================================================================================= +platform linux -- Python 3.8.5, pytest-6.2.1, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python3 +cachedir: .pytest_cache +rootdir: /home/user/GS/dev/sshfs/src/sshfs/build/test, configfile: pytest.ini +collected 16 items + +test/test_sshfs.py::test_sshfs[True-True-0-False] PASSED [ 6%] +test/test_sshfs.py::test_sshfs[True-True-0-True] PASSED [ 12%] +test/test_sshfs.py::test_sshfs[True-True-1-False] PASSED [ 18%] +test/test_sshfs.py::test_sshfs[True-True-1-True] PASSED [ 25%] +test/test_sshfs.py::test_sshfs[True-False-0-False] PASSED [ 31%] +test/test_sshfs.py::test_sshfs[True-False-0-True] PASSED [ 37%] +test/test_sshfs.py::test_sshfs[True-False-1-False] PASSED [ 43%] +test/test_sshfs.py::test_sshfs[True-False-1-True] PASSED [ 50%] +test/test_sshfs.py::test_sshfs[False-True-0-False] PASSED [ 56%] +test/test_sshfs.py::test_sshfs[False-True-0-True] PASSED [ 62%] +test/test_sshfs.py::test_sshfs[False-True-1-False] PASSED [ 68%] +test/test_sshfs.py::test_sshfs[False-True-1-True] PASSED [ 75%] +test/test_sshfs.py::test_sshfs[False-False-0-False] PASSED [ 81%] +test/test_sshfs.py::test_sshfs[False-False-0-True] PASSED [ 87%] +test/test_sshfs.py::test_sshfs[False-False-1-False] PASSED [ 93%] +test/test_sshfs.py::test_sshfs[False-False-1-True] PASSED [100%] + +======================================================================================= 16 passed in 88.42s (0:01:28) ======================================================================================== +``` From a91d12ff8fb004c4b45b40b564efa926434d3757 Mon Sep 17 00:00:00 2001 From: Gabriel Staples Date: Tue, 22 Dec 2020 23:45:24 -0800 Subject: [PATCH 13/15] Update test/README.md --- test/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/README.md b/test/README.md index 0d9e04a9..3594a988 100644 --- a/test/README.md +++ b/test/README.md @@ -1,5 +1,5 @@ -To set up and run the tests, see the [detailed instructions here](../README.md#sshkeygen). +To set up and run the tests, see the [detailed instructions here](../#sshkeygen). Sample test output: From ab2132479b711668f21b8598edefdae08fd4b388 Mon Sep 17 00:00:00 2001 From: Gabriel Staples Date: Tue, 22 Dec 2020 23:47:12 -0800 Subject: [PATCH 14/15] Update link in test/README.md --- test/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/README.md b/test/README.md index 3594a988..e1449a6f 100644 --- a/test/README.md +++ b/test/README.md @@ -1,5 +1,5 @@ -To set up and run the tests, see the [detailed instructions here](../#sshkeygen). +To set up and run the tests, see the [detailed instructions here](https://github.com/libfuse/sshfs#sshkeygen). Sample test output: From f923cd0685b43eddd40333c7ef2ca066da2f06f4 Mon Sep 17 00:00:00 2001 From: Gabriel Staples Date: Wed, 23 Dec 2020 09:24:34 -0800 Subject: [PATCH 15/15] README.md: address a few comments; do a few improvements --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e60ef753..a81657bf 100644 --- a/README.md +++ b/README.md @@ -69,8 +69,9 @@ umount ~/mnt/sshfs 1. It is recommended to run SSHFS as a regular user (NOT as root). For this to work, the mount point must be owned by the user. Therefore, mounting into a `mount` or `mnt` directory you create inside your home directory is a good practice. -1. If the username is omitted, SSHFS will use the local username. -1. If the directory is omitted, SSHFS will mount the (remote) home directory. +1. If the username (`user@` part of the command) is omitted, SSHFS will use the local username. +1. If the directory is omitted (while keeping the colon `:` just before it), SSHFS will mount the + (remote) home directory. 1. If you need to enter a password, SSHFS will ask for it (actually, it just runs `ssh` which asks for the password if needed). @@ -89,7 +90,7 @@ and BSD (as opposed to MacOS), you will also need to install [libfuse][libfuse] MacOS, you need [OSXFUSE][OSXFUSE] instead. Finally, you need the [Glib][Glib] library with development headers, which should be available from your operating system's package manager. -To build and install, we recommend you use [Meson][Meson] (version 0.38 or newer) and +To build and install, you must use [Meson][Meson] (version 0.38 or newer) and [Ninja][Ninja]. After extracting the `sshfs` tarball, create a (temporary) build directory and run Meson: @@ -177,11 +178,13 @@ change it there too. --> ``` For [sample test output, see here](test/README.md). 1. Install `sshfs`: - 1. Normal method: + 1. Normal method. This installs `sshfs` at `/usr/local/bin/sshfs`, whereas your normal Linux + distribution's executable is likely in `/usr/bin/sshfs`. ```bash + # To install sudo ninja install ``` - 1. "Light" method. This technique simply creates a symlink to the executable in your `~/bin` + 1. Alternative method. This technique simply creates a symlink to the executable in your `~/bin` dir so your Linux distro's install still remain's intact and untouched. (For Ubuntu). ```bash # "Install" via a symlink. Note: ensure you are in the same dir as the new `sshfs`