I have more than 60 to 80 systems running Ubuntu. Some of them are with version 8.04 and some of them are with latest version 10.10. Now we are in the process of upgrading all older Ubuntu version to a newer version. It is difficult to switch on every Ubuntu system and taking notes of older Ubuntu version and then upgrade. I have IP addresses of all these machines in a text a file. So I am looking for a simple bash script which will automate the task. I am expecting the output would look like this:
172.29.34.40 ubuntu 10.04
172.29.34.41 ubuntu 8.04
172.29.34.42 ubuntu 8.10
and so on.. Can anyone help me?
You can get the Ubuntu version using
If you want to automate that, write a Bash script that reads list of hosts from stdin and executes the command over SSH. Something like
If you have one common user account on all the machines you want to connect to then this should be what you are looking for
Save it as versions.sh, remembering to make it executable (
chmod a+x versions.sh
), and executeAssuming they are running SSH servers, you could try to guess Ubuntu versions based on the package version of SSH:
Current versions of openssh are listed in Launchpad https://launchpad.net/distros/ubuntu/+source/openssh:
So in my above example,
5.5p1
with a Debian version of-4ubuntu5
looks to be an Ubuntu 10.10 Maverick system.Some servers may have "DebianBanner no" in their
/etc/ssh/sshd_config
file, but the upstream version of OpenSSH is still visible which is sufficient to identify the system still (each release of Ubuntu so far has a different upstream version of OpenSSH).