Batch upload script and execute

General support questions
Post Reply
jamesy281
Posts: 11
Joined: 2015/02/16 16:30:01

Batch upload script and execute

Post by jamesy281 » 2015/08/26 16:12:22

Hi,

I have a requirement to add an SSH login banner to all our Centos boxes. As there are quite a few I would like to script the process. I have what I believe are all the pieces but I am stumbling putting them all together. Ideally what I would like to do is:

Loop though a list of server names
Connect to each and upload a small script (currently I am testing with LFTP as I can pass the password also)
Execute the script
Exit

I have a shell script to cat the text I need into the /etc/issue.net file and the subsequent /etc/ssh/sshd_config file and restart the sshd daemon. I just need to get them uploaded and executed.

I welcome any suggestions for a simpler way of doing this.

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: Batch upload script and execute

Post by aks » 2015/08/26 17:08:19

So two things.
1) Do you need to restart sshd? I thought issue.net was "obeyed" by sshd anyway?
2) There is an argument you can present to ssh which says "just execute the following". I think it's -C, but you can check in the ssh manual (man ssh)

Alternatively, use something (cool) like Anisble....

jamesy281
Posts: 11
Joined: 2015/02/16 16:30:01

Re: Batch upload script and execute

Post by jamesy281 » 2015/08/28 20:26:39

Aks,

Thanks for the reply. I'm not sure about the need to restart sshd after edititing the issue.net file so I will test to see.

With regards the -c switch that is for compression I believe I'm ssh. I have managed to put to get her a comma d that works using LFTP which comprises SSH aft and the mput command.

Thanks again for the input.

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Batch upload script and execute

Post by TrevorH » 2015/08/29 22:33:28

It sounds like what you really need is to investigate one of the many configuration management packages like puppet/salt/ansible/chef/cfengine.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply