从plink.exe在Linux上执行sudo命令[窗口] [英] execute sudo command on linux from plink.exe[windows]

查看:883
本文介绍了从plink.exe在Linux上执行sudo命令[窗口]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我执行命令砰砰

砰砰user@192.168.1.12须藤纳米/ etc / hosts中

输入后出现提示时输入密码,我得到

Upon typing the password when prompted, I am getting

须藤:没有TTY present并没有指定任何askpass程序

sudo: no tty present and no askpass program specified

对不起,再试一次。

须藤:没有TTY present并没有指定任何askpass程序

sudo: no tty present and no askpass program specified

对不起,再试一次。

须藤:没有TTY present并没有指定任何askpass程序

sudo: no tty present and no askpass program specified

对不起,再试一次。

须藤:3不正确的密码尝试

sudo: 3 incorrect password attempts

如何从砰砰执行sudo命令?或者是还有什么办法?

How to execute the sudo command from plink? Or is there any alternatives?

推荐答案

我知道这个问题是旧的,但这样可以帮助

i know that the question is old but this can help

您可以执行砰砰(腻子工具)

you can execute plink (putty tools)

砰砰-v -ssh -m路径/要/ commands.txt中-l usertologin -pw PASSWORDSERVER

commands.txt中:

commands.txt:

回声-e密码\\ n|须藤-S CAT / etc / passwd文件

须藤-S是从标准输入和回声-e密码\\ N收到的密码是通过密码(和\\ n是喜欢preSS介绍 - 新线 - )

sudo -S is to receive the password from stdin and with the echo -e "password\n" is to pass the password (and \n is like to press intro -new line- )

您可以执行passwd命令以同样的方式:

the same way you can execute the passwd command:

> echo -e "OLDPASSWORD\nNEWPASSWORD\nNEWPASSWORD" | passwd

这篇关于从plink.exe在Linux上执行sudo命令[窗口]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆