Home > OS >  Sincerity to ask: when you use the sudo command, how to realize the free dense (especially when writ
Sincerity to ask: when you use the sudo command, how to realize the free dense (especially when writ

Time:11-15

I use the following command to realize from secret copy a file, but still hint to enter a password each time, knelt realistic where there is an error for
Echo 'gpdi | sudo cp -r/home/gpdi/xl/save/" + task_id + "/" + "" +"/home/gpdi/xl/warehouse/" + task_id + "/"

Bosses told the correct wording, genuflect is begged by the way, how to write a shell script, thanks

CodePudding user response:

The/etc/sudoers command/permissions NOPASSWD add need

CodePudding user response:

Add in the/etc/sudoers file user name ALL=(ALL) NOPASSWD: ALL this line of code, specific can see this blog post
https://blog.csdn.net/weixin_45663905/article/details/107157280
The hope can help you

CodePudding user response:

refer to the original poster wykqhyjs response:
I use the following command to realize from secret copy a file, but each still prompt to enter a password, knelt realistic where there is an error for
Echo 'gpdi | sudo cp -r/home/gpdi/xl/save/" + task_id + "/" + "" +"/home/gpdi/xl/warehouse/" + task_id + "/"

Bosses told the correct wording, genuflect is begged by the way, how to write a shell script, thank you

Sudo -s

Echo 'gpdi | sudo -s cp -r/home/gpdi/xl/save/" + task_id + "/" + "" +"/home/gpdi/xl/warehouse/" + task_id + "/"
  • Related