In my environment there are about 1000 production servers. Direct root login is disabled on all servers. There is one user abc which has sudo access. We login to each computer using abc and then sudo su - to get root access.Please note that I am running this script on a Ubuntu machine and connecting to a RHEL machine.There is a requirement to know hostname and OS version of each remote server IP.So I made a script which will connect with remote system and execute a command and saves output in a local file.Script which I managed to create is as below:for i in `cat test1` do {     echo ***************************$i***************************************     sshpass -p 'password' ssh abc@ipaddress /sbin/ifconfig >> /home/ankush/output.txt} done It connects to all computers IP address present in test1 file and executes, but doesn't execute ifconfig command on the remote system.On execution it is giving error as:***************************ip address***************************************bash: /sbin/ifconfig: No such file or directory
Remote discovery of hostname and IP address
util linux