`

脚本报错:sudo: no tty present and no askpass program specified

 
阅读更多

sudo will only run a program as a different user if one of these 3 conditions has been met (as far as passwords are concerned):

  1. the NOPASSWD option is specified
  2. the user entered the correct target password
  3. the user entered the correct source password

Since options 2 and 3 require a TTY (sudo won't read from a pipe) it won't run if it can't find one. Check your script if at any point you're running a script remotely using ssh, as it's possible that it won't allocate a TTY for a non-interactive remote command.

分享到:
评论

相关推荐

    springboot 报错:no libsigar-amd64-linux.so in java.library.path 时所需安装包

    在使用Spring Boot开发Java应用程序的过程中,可能会遇到一个特定的错误提示:“no libsigar-amd64-linux.so in java.library.path”。这个错误是由于系统缺少一个名为libsigar的库,特别是其AMD64架构的Linux版本,...

    Linphone编译错误及解决方法

    1. sudo apt-get install build-essential 在编译Linphone之前,需要安装基本的编译工具。使用上面的命令可以安装这些工具。 2. No package 'gtk+-2.0' found 错误原因:缺少gtk+-2.0依赖项。 解决方法:sudo ...

    shell字符串截取报错:Bad substitution的解决

    运行 ${GIT_COMMIT:0:6}报错: /tmp/jenkins7505855461406722507.sh: 4: /tmp/jenkins7505855461406722507.sh: Bad substitution 原因:两种shell语言解释器 bash和dash 查看当前/bin/sh 指向哪种解释器: ls /...

    **Gcc编译器报错:gcc -m32报错**

    Gcc编译器报错:gcc -m32报错 :/work/printf_myself$ gcc -m32 -o push_test push_test.c In file included from /usr/include/stdio.h:27:0, from push_test.c:12: /usr/include/features.h:367:25: fatal error: ...

    解决laravel 5.1报错:No supported encrypter found的办法

    在使用 Laravel 5.1 开发项目时,可能会遇到一个特定的错误提示:“No supported encrypter found. The cipher and / or key length are invalid.” 这个错误意味着 Laravel 无法找到支持的加密器,通常与应用的加密...

    linux编写bash shell脚本文件.sh 自动输入密码.在脚本中使用sudo命令,将密码保存在脚本中,不需要手动输入密码

    在某些场景下,我们可能需要在脚本中使用`sudo`命令来执行需要管理员权限的操作。通常,运行带有`sudo`的命令时,系统会提示用户输入密码。然而,为了实现自动化,我们不希望在脚本执行过程中手动输入密码。本文将...

    python3.7.zip

    在ubuntu 16.04 上源码编译好的python3.7.2,适合离线安装Python使用.使用方式如下: ...#执行python3.7可会报错:没有权限 #那么接着执行 sudo chmod 777 /usr/bin/python3.7 sudo chmod 777 /usr/bin/pip3.7

    08 fatal error_ openssl_sha.h_ No such file or directory 解决方案 -

    在Linux系统中,当您尝试编译某个项目或软件,特别是涉及到网络安全和加密的库时,可能会遇到“fatal error: openssl/sha.h: No such file or directory”这样的错误。这个错误意味着您的系统缺少OpenSSL库的头文件...

    Django重装mysql后启动报错:No module named ‘MySQLdb’的解决方法

    这个问题的典型症状是当你尝试启动Django应用时,系统抛出一个异常:`django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'`。这个错误表明你的Python环境中缺少...

    Ubuntu下apt-get方式安装LNMP

    sudo apt-get install nginx 然后,启动Nginx服务: sudo /etc/init.d/nginx start 或者: service nginx start 二、安装PHP和MySQL 接下来,安装PHP和MySQL: sudo apt-get install ...

    ubuntu命令行.pdf

    7. 安装/卸载 .deb 文件:sudo dpkg -i package_file.deb, sudo dpkg -r package_filename 8. 转换 .rpm 文件到 .deb 文件:sudo alien package 9. 安装 tarball:tar xfvz tarball_name 二、APT 软件包管理工具 ...

    快速访问github的方式

    hosts 文件在每个系统位置:Windows ...Linux 命令:sudo nscd restart,如报错则须安装:sudo apt install nscd 或 sudo /etc/init.d/nscd restart Mac 命令:sudo killall -HUP mDNSResponder Tips: 无效可重启机器

    Ubuntu下ssh服务的安装和配置文档

    sudo /etc/init.d/sshd start 安装 SSH 服务 安装 SSH 服务之前,需要更新源,以便安装最新的 SSH 服务。可以使用以下命令来更新源: sudo apt-get update 然后,使用以下命令来安装 SSH 服务: sudo apt-get ...

    树莓派python3安装opencv遇到的问题总结

    安装环境: 1、 树莓派4B ...E: Package 'libcblas-base-dev' has no installation candidate 进行更新和升级 sudo apt-get update sudo apt-get upgrade 问题二 解决: sudo apt-get install libjaspe

    深度linux 常用命令

    - 删除更新和升级的缓存软件:cd /var/cache/apt/archives/ && sudo rm *.deb Deb命令允许用户直接对deb格式的软件包进行操作,主要命令有: - 查看软件包的详细情况:sudo dpkg -l - 查询已安装的deb包的信息:...

    Windows环境下npm install 报错: operation not permitted, rename的解决方法

    sudo npm install --no-bin-links ``` 这样npm将不会创建软链接,而是直接复制文件,避免了权限问题。 4. **清理npm缓存**: 在尝试重新安装之前,清理npm的缓存是很重要的。这可以通过运行以下命令完成: ```...

    当前真实可用的docker配置&使用

    Docker 是一个开源的应用容器引擎,它允许开发者打包他们的应用以及应用的运行环境到一个可移植的容器中。以下是配置和使用 Docker 的基本步骤: 安装 Docker 系统要求:确保你的系统...sudo systemctl enable docker

    sudo-rootsh:sudo-rootsh脚本

    【sudo-rootsh脚本详解】 sudo-rootsh是一个用于在Linux环境中通过sudo命令安全地切换到root权限的脚本。在Linux系统中,sudo是让用户以管理员(root)权限执行命令的工具,通常用于避免直接使用root账户登录,以...

Global site tag (gtag.js) - Google Analytics