Got errors when using sudo with ps
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start at watchers.Responder.submit and follow runner.Runner.handle_output, _handle_output, respond, and write_proc_stdin. Reproduce the sudo ps axww command on Debian and inspect the response triggered by the process-list output. Done means the output no longer causes a password write after the Paramiko channel closes or an OSError: Socket is closed ThreadException.
Written by the indexing model from the issue text.
Description
Hi,
This is not exactly an issue, more of a warning for people having this kind of issues. It is both related to the invoke and the paramiko library
I am using fabric (which is based on paramiko and invoke) in order to retrieve a list of running processus on a Debian server with ps axww -o pid=,ppid=,etimes=,command=. At that time, I used the sudo function to run it.
From time to time, I got a ThreadException, and it came out that it was coming from the invoke library: when doing the ps command, I got the following output:
3432669 1 0 /lib/systemd/systemd --user
3432670 3432669 0 (sd-pam)
3432716 2 0 [kworker/9:1]
3432730 3432625 0 sshd: xxx@notty
3432731 3432730 0 sudo -S -p [sudo] password: ps axww -o pid=,ppid=,etimes=,command=
3432732 3432731 0 ps axww -o pid=,ppid=,etimes=,command=
As the -p [sudo] password: option appears in the command output, the watchers.Responder.submit function returns matches, and triggers the runner.Runner.handle_output -> _handle_output -> respond -> write_proc_stdin function, thinking it should send the password.
As the paramiko channel get closed once the command output is printed, the write_proc_stdin sometimes tries to write the password after the channel closure, which triggers a ThreadException OSError: Socket is closed
(Sorry if I am not using the correct terminology, I am not a developer)
- Dominant language
- Python
- Stars
- 4.8k
- Forks
- 412
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
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 pyinvoke/invoke
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Similar issues
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
simonw/sqlite-utils#872 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100