FreeAntivirus

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Thursday, May 13, 2010

Script to Login to a remote machine with a given password

Posted on 7:38 AM by Unknown

#!/bin/bash
HOST="localhost"
USER="myuname"
PASS="mypassword"

VAR=$(expect -c "
spawn ssh $USER@$HOST
expect \"password:\"
send \"$PASS\r\"
expect \"\\\\$\"
send \"ls\r\"
expect -re \"$USER.*\"
send \"logout\"
")

echo "==============="
echo "$VAR"


ref : http://ubuntuforums.org/showthread.php?t=192929
Email ThisBlogThis!Share to XShare to Facebook
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • [ How to ] Use CentOS repos in RHEL-5 Server
    1. Remove "yum-rhn-plugin" package from RHEL, this is used to check the activation in RHEL. # rpm -e yum-rhn-plugin 2. Remove the ...
  • Google's G1 phone : Reviews
    The T-Mobile G1 Android-powered phone is the first mobile phone with the operating system (OS) designed by Google.Given Google's reputat...
  • How to Connect Wifi card using Command line
    To scan wireless networks sudo iwlist scanning then change the mode to "managed" iwconfig wlan0 mode Managed then to set SSID iwco...
  • Google Chrome logo derived from Microsoft's logo ??
  • Google introduced new Voice and Video Chat !!
    Google today launched Gmail voice and video chat, making it simple for people around the world to chat in high-quality video for free right ...
  • How to install Windows 7 from Ubuntu without burnning a disc
    If you’re running on ubuntu and want to install Windows 7 without burning a disc,you can try following steps to install Windows 7 with the i...
  • [How to] boot from Linux ISO FILE using Grub 2
    Edit /etc/grub.d/40_custom and add the below entry menuentry "Karmic Live CD (sdaX)" { loopback loop (hd0,X)/my-ISO/ubuntu-9.10-de...
  • Convert text files to MP3 under Linux
    First we would need to install festival. We can install festival with the following command :sudo apt-get install festivalNow we need to ins...
  • Google Launches Linux Software Repositories
    Google has just released the Google Linux Software Repositories, a centralized place where we can download and update the latest ve...
  • Installing Ubuntu without external media
    The below method is only applicable if you alread have Linux (any) running, here I am using OpenSuSe 11.1 to install ubuntu-9.04 (Jaunty Ja...

Categories

  • administration
  • Antivirus
  • Apache
  • Apple
  • AppZ
  • Blog
  • boot
  • CentOS
  • Communication
  • Database
  • disc
  • Download
  • Drivers
  • Editor
  • encryption
  • Fedora
  • File management
  • Filesystem
  • Font
  • Fun
  • gaming
  • Gnome
  • Google
  • Gossips
  • How to ...
  • internet
  • KDE
  • Kernel
  • Kidz
  • laptop
  • Linux
  • Linux embedded Devices
  • Mail
  • Media centre
  • Memory
  • mobile
  • MS
  • multimedia
  • network
  • News
  • Oracle
  • PDF
  • pendrive
  • Perl
  • processor
  • Programming
  • proxy
  • Reviews
  • script
  • security
  • sql
  • Squid
  • ssh
  • Supercomputer
  • SuSe
  • Themes
  • trickz n tipz
  • TweakZ
  • ubuntu
  • Video
  • Video editing
  • Virus
  • zip

Blog Archive

  • ▼  2010 (62)
    • ►  June (1)
    • ▼  May (6)
      • Script to Login to a remote machine with a given p...
      • How to fix intel video card freezing problem in Ub...
      • Downgrading GRUB [ Ubuntu 10.04 ]
      • Easter eggs in Firefox !!
      • How to change Ubuntu 10.04 (Lucid) 's Plymouth ( b...
      • Expected features in Fedora 13 Goddard
    • ►  April (28)
    • ►  March (11)
    • ►  February (5)
    • ►  January (11)
  • ►  2009 (367)
    • ►  December (16)
    • ►  November (23)
    • ►  October (45)
    • ►  September (44)
    • ►  August (35)
    • ►  July (1)
    • ►  June (20)
    • ►  April (6)
    • ►  March (8)
    • ►  February (18)
    • ►  January (151)
  • ►  2008 (69)
    • ►  December (31)
    • ►  November (38)
Powered by Blogger.

About Me

Unknown
View my complete profile