[英]How to login (using both username and password) as a non root user in linux in a shell script?
I have a non root user euser with a certain password. 我有一个具有特定密码的非root用户euser。
I am also writting a shell script thru which first I need to login thru euser and then run a installer. 我还要编写一个shell脚本,首先需要通过euser登录,然后运行安装程序。
Shell script contents - Shell脚本内容-
/bin/bash
su - newuser
cd installdir
./install.sh
When this script executes it gives error as - 执行此脚本时,错误为-
Password:
su: Authentication failure**
How I can avoid this error and make my script work? 如何避免此错误并使脚本正常工作?
su is for human interaction. su用于人类互动。 try sudo for single commands. 对于单个命令,请尝试sudo。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.