ble`within` does not seem to respect `as`
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 25/100
Research direction
Start with the README sections describing the stackable within/as/with behavior, then trace the local and netssh backends while reproducing the provided example. Confirm whether the command inside within uses the enclosing as user and verify the corrected behavior with an equivalent permission-restricted directory scenario.
Written by the indexing model from the issue text.
Description
From the readme, within/as/with should be stackable. But this scenario, that does not work as expected:
require 'sshkit'
require 'sshkit/dsl'
include SSHKit::DSL
# Set up a directory that your user cannot enter
`sudo mkdir -p /tmp/only_root`
`sudo chmod og-rwx /tmp/only_root`
on :local do
# But root should be able to enter it...
as :root do
within '/tmp/only_root' do
execute :ls # --> Permission denied
end
end
end
It looks like within always runs as the user executing the script, which is unexpected. I would have thought that it's done as the user of the enclosing as. I've tried with the local and netssh backends and get the same results.
This is with SSHKit 1.11.3 and Ruby 2.3.1 on Centos 6.
- Dominant language
- Ruby
- Stars
- 1.2k
- Forks
- 257
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from capistrano/sshkit
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
capistrano/sshkit#563 · 6 reactions ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
capistrano/sshkit#562 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
capistrano/sshkit#554 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
capistrano/sshkit#543 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
capistrano/sshkit#518 · 1 comment ·
All issues in capistrano/sshkit
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ai-generated
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
hanami/hanami-cli#449 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
hanami/hanami-router#310 ·