Archive for June, 2006

Automatisation of telnet, ftp or ssh

Monday, June 12th, 2006

For ftp you have a quick and dirty trick :

$ ftp -n yourhost <<-here
> quote USER youruser
> quote PASS yourpassword
> ls
> quit
> here

(you can do a put, get, whatever you want instead of “ls”)

For telnet similar idea:

$ (echo -e “open yourhostr”; sleep 2;echo -e “youruserr”; sleep 1; echo -e “yourpassword”; sleep 1; echo -e “unamer”; sleep 1; echo -e “exit”) | telnet

That sound pretty good but … it does not work on solaris (ok on Linux), and no way for ssh :(

So if this shoddy doesn’t meet your expectations…

Expect is what you are looking for. Available for GNU-linux, solaris… MSwindows… at http://expect.nist.gov/
For debian do it cool:

apt-get install expect

I do it with 2 scripts. I’m sure that you can do better, but that’s work ;-)

– script to call the expect and to make things good looking:
host=$1
psswd=$2
cmd=$3
os=$( ./expectaTion.tcl $host $psswd $cmd| awk “/$cmd/ “‘{getline; print}’|tr -d ‘

OpenSolaris/Solaris 10 primer

Saturday, June 10th, 2006

The next link will show you a set of wonderful features of the OpenSolaris and Solaris operating systems. This has been written by the Open Solaris Community: OpenSolaris Primer. Many thanks to them.