I'm currently setting up a batch file to ssh from a Windows machine into a Ubuntu machine and issue a series of commands. I'm using plink, and I'm using the -m
argument to pass a .txt file with a list of commands.
The batch file code that runs through cmd
:
set PATH=c:\path\to\plink.exe
plink.exe -ssh -t user@ipaddress -pw <psw> -m c:\path\to\textFile\commands.txt
The commands.txt
code:
sudo -s #access the root login
<root psw> #enter the password for the root login
command-1 #issue a command in linux as root
command-2 #issue a command in linux as root
command-3 #issue a command in linux as root
The issue I'm running into is that when I run this batch file, the output within command prompt still prompts the user to manually enter the password. Is there a means to input the password form the next line of the commands.txt
file? Or does this process require something else?
/etc/sudoers
file on the Ubuntu machine to includeNOPASSWD
for this user.