-bash: /etc/bashrc: Permission denied sudo: sorry, you must have a tty to run sudo 报错解决
Posted 我的紫霞辣辣
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了-bash: /etc/bashrc: Permission denied sudo: sorry, you must have a tty to run sudo 报错解决相关的知识,希望对你有一定的参考价值。
使用ansible进行ssh用户身份登录连接至Linux主机出现以下报错
k8s-worker-01 | FAILED! =>
"ansible_facts":
"discovered_interpreter_python": "/usr/bin/python"
,
"changed": false,
"module_stderr": "/home/nana/.bashrc: line 5: /etc/bashrc: Permission denied\\nsudo: sorry, you must have a tty to run sudo\\n"
"module_stdout": "",
"msg": "MODULE FAILURE\\nSee stdout/stderr for the exact error",
"rc": 1
解决方案,登录至客户端主机(被控制主机)
chmod 755 /etc/bashrc
chmod 755 /etc/sudoers
vim /etc/sudoers # 注释以下这行
...
#Defaults requiretty
...
以上是关于-bash: /etc/bashrc: Permission denied sudo: sorry, you must have a tty to run sudo 报错解决的主要内容,如果未能解决你的问题,请参考以下文章
/etc/bashrc和/etc/profile傻傻分不清楚?
Linux中/etc/profile,/etc/bashrc,~/.profile,~/.bashrcd的区别