New Posts  All Forums:Forum Nav:

ssh login script?

post #1 of 4
Thread Starter 
i spent the last hour looking around online for a way to do a ssh login via Perl or c-shell and im really not getting anywhere. everything ive found requires me to install other packages. The computers im using this on are at work so installing other packages is out of the question. Python is another option but I've never touched it before. the basic layout would be something like

ssh ____@_____
password
setenv ______
cmd1.pl&
cmd2.pl&
cmd3.pl&
cmd"etc. etc."


is there any simple way to do this? the cmd1-3.pl are very long and I'm getting tired of typing everything out all the time.
dBag
(9 items)
 
yep...
(10 items)
 
air
(8 items)
 
CPUMotherboardRAMHard Drive
xeon e3-1230v2 supermicro mbd x9scm-0 KVR1333D3E9S/4G OCZ vertex3 60GB 
CoolingOSPowerCase
1u 80mm blower + passive cpu  proxmox 3.1 supermicro 300w 1u supermicro 1u 
Other
2x intel pro1000 nics  
CPUMotherboardGraphicsRAM
A8-3870K @ 3.7GHz GIGABYTE A75M-UD2H Power Cooler 7870 Team Group Inc 
Hard DriveCoolingOSPower
3x OCZ Agility 3 60GB (RAID-0 on Rocket RAID 27... Corsair H-80 core win-7 Seagate 750 Gold 
CaseAudio
some lian-li case... M-Audio AV40s + 10" Sony ___? 
CPUMotherboardGraphicsRAM
D525 @ 1.8GHz Supermicro onboard 2x2GB DDR1333 
Hard DriveOSCaseOther
WD Green ubuntu 12 1u  3x40mm fans  
  hide details  
Reply
dBag
(9 items)
 
yep...
(10 items)
 
air
(8 items)
 
CPUMotherboardRAMHard Drive
xeon e3-1230v2 supermicro mbd x9scm-0 KVR1333D3E9S/4G OCZ vertex3 60GB 
CoolingOSPowerCase
1u 80mm blower + passive cpu  proxmox 3.1 supermicro 300w 1u supermicro 1u 
Other
2x intel pro1000 nics  
CPUMotherboardGraphicsRAM
A8-3870K @ 3.7GHz GIGABYTE A75M-UD2H Power Cooler 7870 Team Group Inc 
Hard DriveCoolingOSPower
3x OCZ Agility 3 60GB (RAID-0 on Rocket RAID 27... Corsair H-80 core win-7 Seagate 750 Gold 
CaseAudio
some lian-li case... M-Audio AV40s + 10" Sony ___? 
CPUMotherboardGraphicsRAM
D525 @ 1.8GHz Supermicro onboard 2x2GB DDR1333 
Hard DriveOSCaseOther
WD Green ubuntu 12 1u  3x40mm fans  
  hide details  
Reply
post #2 of 4
Do you need to run commands remotely? If so this should work for perl.
Code:
my $output = `ssh user\@server "command1; command2; command3; exit;"`

If you need an auto login (including automated password entry) then I think you may want to look into expect.
post #3 of 4
you can pretty easily setup rsa key exchanges for a password less login

http://www.debian-administration.org/articles/152

if it's just one simple command ssh -t [user]@[host] -C '[the command]' is simple enough. if it's not really a simple command and more of a a script to run ... scp [your-script.sh] [user]@[host]: && ssh -t [user]@[host] -C './[your-script.sh] && rm ./[your-script.sh]'

Generally prefer && to ; as the second commnand only executes if the first one succeeds. ; just keeps running even when something fails.
stable again
(25 items)
 
  
CPUCPUMotherboardGraphics
E5-2687W E5-2687W ASUS Z9PED8-WS EVGA GTX 570 (Linux host) 
GraphicsRAMHard DriveHard Drive
EVGA GTX 970 FTW (win7 guest) 64GB G.SKILL 2133 2x Crucial M4 256GB raid1 4x 3TB raid 10 
CoolingCoolingCoolingCooling
2x Apogee HD  2x RX 480 2x MCP 655 RP-452x2 rev2 (new) 
CoolingCoolingOSOS
16x Cougar Turbine CFT12SB4 (new) EK FC 580 Gentoo (host) Gentoo (x23 guests) 
OSMonitorMonitorPower
windows 7 (guest w/ vfio-pci) Viewsonic 23" 1080P Viewsonic 19" Antec HCP Platinum 1000 (new) 
CaseOtherOther
Case Labs TH10 (still the best ever) 2x Lamptron FC-5 IOGEAR 2 way DVI KVM Switch 
  hide details  
Reply
stable again
(25 items)
 
  
CPUCPUMotherboardGraphics
E5-2687W E5-2687W ASUS Z9PED8-WS EVGA GTX 570 (Linux host) 
GraphicsRAMHard DriveHard Drive
EVGA GTX 970 FTW (win7 guest) 64GB G.SKILL 2133 2x Crucial M4 256GB raid1 4x 3TB raid 10 
CoolingCoolingCoolingCooling
2x Apogee HD  2x RX 480 2x MCP 655 RP-452x2 rev2 (new) 
CoolingCoolingOSOS
16x Cougar Turbine CFT12SB4 (new) EK FC 580 Gentoo (host) Gentoo (x23 guests) 
OSMonitorMonitorPower
windows 7 (guest w/ vfio-pci) Viewsonic 23" 1080P Viewsonic 19" Antec HCP Platinum 1000 (new) 
CaseOtherOther
Case Labs TH10 (still the best ever) 2x Lamptron FC-5 IOGEAR 2 way DVI KVM Switch 
  hide details  
Reply
post #4 of 4
To be honest, you really should be looking at CPAN for this kind of stuff:
http://search.cpan.org/~turnstep/Net-SSH-Perl-1.34/lib/Net/SSH/Perl.pm

Also, and as Lloyd has already said, you really need keys if you want passwordless.
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Linux, Unix