8000 sudo hang · Issue #43 · dacr/jassh · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

sudo hang #43

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

Open
q1208c opened this issue Aug 20, 2024 · 1 comment
Open

sudo hang #43

q1208c opened this issue Aug 20, 2024 · 1 comment

Comments

@q1208c
Copy link
q1208c commented Aug 20, 2024

when try use 'become' run command with sudo, then program hang without any output or error.
below is the code(some function).

    def runWithSudo(cmdString: String): (Boolean, String) = {
        log.info(
            s"run command '${cmdString}' with sudo on '${this.user}@${this.host}:${this.port}'"
            )
        val sshOptions         = this.sshOption()
        var runState : Boolean = false
        var runResult: String  = ""
        try {
            SSH.once(sshOptions) { ssh => {
                val (r1, r2) = ssh.shell { sh =>
                    sh.become("root") -> sh.execute(cmdString)
                }
                runState = r1
                runResult = r2
            }
            }
        } catch {
            case ex: Exception => log.error("SSHHost.runWithSudo", ex)
        }
        (runState, runResult)
    }

The SSHOption is only set user, host, port, all other is default.

I think there something wrong, what I can do?
Thanks.

@q1208c
Copy link
Author
q1208c commented Aug 20, 2024

Sorry, I lose some thing.

The user I used do not have right to use with sudo (in command line shell).
Because this is the normal working case, some user have right with sudo, the other not, I try check the user have sudo right or not.

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

No branches or pull requests

1 participant
0