Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bw export : "cannot save file to <path>" when using --output #4619

Closed
1 task done
alexishorner opened this issue Feb 1, 2023 · 3 comments
Closed
1 task done

bw export : "cannot save file to <path>" when using --output #4619

alexishorner opened this issue Feb 1, 2023 · 3 comments
Labels
bug cli CLI Application

Comments

@alexishorner
Copy link

alexishorner commented Feb 1, 2023

Steps To Reproduce

  1. bw login
  2. bw unlock
  3. export BW_SESSION="<session key>"
  4. bw export --format json --output "/path/to/export_file.json"

Expected Result

A new export is created at the given location.

Actual Result

No file is created and the error Cannot save file to /path/to/export_file.json is displayed.

Screenshots or Videos

No response

Additional Context

  1. This issue also occurs without --output "/path/to/export_file.json", i.e. bw export --format json
  2. Everything works fine if I do bw export --format json --raw 1> "/path/to/export_file.json". I opened the export in a text editor and it seems good.
  3. I tested in two directories, both of which I have write permissions to
  4. The directory and file names contain no spaces or special characters
  5. I installed bitwarden cli through snap

Operating System

Linux

Operating System Version

Kubuntu 22.04 kernel 5.15.0-58-generic

Shell

Bash

Build Version

2023.1.0

Issue Tracking Info

  • I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress.
@alexishorner alexishorner added bug cli CLI Application labels Feb 1, 2023
@joshuabjordan
Copy link

Hi there,

I attempted to reproduce your issue and was unable to do so. Please review our documentation on using export here. https://bitwarden.com/help/cli/#export - Ensure you are running the latest version of the CLI. You can view how to update this here. https://bitwarden.com/help/cli/#update

We use GitHub issues as a place to track bugs and other development related issues. If your issue persists, please write us back using our contact form, so we can continue troubleshooting: https://bitwarden.com/contact/

You can include a link to this issue in the message content.

Alternatively, you can also search for an answer in our help documentation (https://bitwarden.com/help/) or get help from other Bitwarden users on our community forums (https://community.bitwarden.com/c/support/).

The issue here will be closed.

Thanks!

@peterrus
Copy link

peterrus commented Aug 25, 2024

@joshuabjordan are you sure you tested the snap? Because I am seeing the same issue when running bw from a snap. (cc @alexishorner )

Maybe related? #3923 (comment)

@alexishorner
Copy link
Author

alexishorner commented Aug 25, 2024

Thanks @peterrus for the notification. I agree that this is very likely a permission issue with the snap.

Sorry @joshuabjordan, I hadn't seen your reply. I think I'm using the export command right, since it works with --raw. I am still experiencing the bug.

Here are some commands I ran today to test again:

$ bw update
No update available.
$ bw --version
2024.8.0
$ which bw
/snap/bin/bw
$ snap --version
snap    2.63+22.04ubuntu0.1
snapd   2.63+22.04ubuntu0.1
series  16
ubuntu  22.04
kernel  6.8.0-40-generic
# snap refresh bw
snap "bw" has no updates available
$ mkdir bw_tmp
$ cd bw_tmp
$ pwd
/home/<username>/bw_tmp
$ bw login
You are already logged in as  <email address>
$ bw unlock
? Master password: [hidden]
Your vault is now unlocked!

To unlock your vault, set your session key to the `BW_SESSION` environment variable. ex:
...

$ export BW_SESSION="<session key>"
$ bw export --format json --output "test.json"
Cannot save file to /home/<username>/bw_tmp/test.json
$ bw export --format json --output "/home/<username>/bw_tmp/test.json"
Cannot save file to /home/<username>/bw_tmp/test.json
$ bw export --format json --raw > "test.json"
$ less test.json
<shows valid export file>

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cli CLI Application
Projects
None yet
Development

No branches or pull requests

3 participants