LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   plink script build (https://www.linuxquestions.org/questions/debian-26/plink-script-build-4175727152/)

TVining 07-20-2023 12:15 PM

plink script build
 
Anyone in here able to build me a quick plink script for debian machines?
I want it to log in, go to SUDO and run an adduser command, log out, and log any resulting messages. Move on to the next machine, do the same.
if the commands were in a second text file that I could modify easily, that'd be a bonus.

Thank You!

pan64 07-21-2023 06:18 AM

I would rather implement it in a shell script, copy it to the target host and execute (and repeat)

TVining 07-21-2023 07:11 AM

I would rather see that, too. However I'm limited on what tools the windows machines allow to be run, and plink is one that it does.
I normally load the files I use for an upgrade to the windows servers, do the upgrade to the Deb11 machines, and then delete the files, so I'm not concerned about storing the plain text password- it's literally only on the machine an hour at most, and the server has a very narrow allowance of people able to log in.

pan64 07-21-2023 07:28 AM

no, the shell script should run on the linux host, on windows you do nothing, just copy it to the remote server and start it (using putty).

TVining 07-21-2023 07:36 AM

The idea is to not have to individually log into each linux host (about 200 of them) to run the script.
The Debian machines are very stripped with extremely limited tools on them, but bash scripts can be run.
I also would like a single log file that tells me what host and the results. (knowing of course that if the account was created, there is no CLI feedback, but if the account was there, it will tell me that).

michaelk 07-21-2023 09:56 AM

By limited I am guessing you need a Windows batch versus powershell script? plink can read commands from a text file using the -m option. I rarely need to write a batch script and it takes me a bit of effort to remember its syntax as compared to linux scripting...

Your asking members who volunteer their time to write the script for you instead of helping is considered rude by some.


All times are GMT -5. The time now is 09:36 AM.