canonical / canonical/jhack

"Permission denied" ssh errors on accessing unit-state.db

Open
#113 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
60
Forks
31
Avg merge
2d 15h
Merged PRs (30d)
1

Description

## Issue
show-stored errors out,
```
$ jhack show-stored cos-proxy/0
ERROR:jhack:failed to fetch db; command ['juju', 'scp', 'cos-proxy/0:/var/lib/juju/agents/unit-cos-proxy-0/charm/.unit-state.db', '/home/ubuntu/snap/jhack/235/unit-state-otlo29cu.db'] exited with 1
failed to fetch db; aborting. b'ERROR exit status 1 (scp: /var/lib/juju/agents/unit-cos-proxy-0/charm/.unit-state.db: Permission denied)\n'
```

because of file permissions:
```
$ juju ssh cos-proxy/0 ls -la /var/lib/juju/agents/unit-cos-proxy-0/charm/.unit-state.db
-rw------- 1 root root 20480 Dec 6 17:58 /var/lib/juju/agents/unit-cos-proxy-0/charm/.unit-state.db
```

## Solution attempts
ssh-ing with root doesn't work,
```
$ juju ssh root@cos-proxy/0 hexdump /var/lib/juju/agents/unit-cos-proxy-0/charm/.unit-state.db
root@10.41.168.28: Permission denied (publickey).
```

but a sudo helps
```
$ juju ssh cos-proxy/0 sudo hexdump /var/lib/juju/agents/unit-cos-proxy-0/charm/.unit-state.db
0000000 5153 694c 6574 6620 726f 616d 2074 0033
0000010 0010 0101 4000 2020 0000 0900 0000 0500
...
Connection to 10.41.168.28 closed.
```

Not sure to translate this to a `juju scp` command, but perhaps could pipe stdout instead?

## Environment
- jhack latest/stable 0.3.19.1.1 2023-09-01
- Juju 3.1.6 on Ubuntu 22.04 vm (multipass).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.