Author Topic: remote ssh bash script  (Read 1198 times)

0 Members and 1 Guest are viewing this topic.

Offline optics

  • Jr. Mitglied
  • **
  • Posts: 96
  • ŏp'tĭks
  • Branch: unstable
  • Desktop: ℵfce
  • GPU Card: Intel HD4400 + Radeon HD8550M
  • GPU driver: intel-ati-bb
  • Kernel: 4.6
  • Skill: Novice
remote ssh bash script
« on: 15. February 2016, 12:37:48 »
does anyone know how to create a bash script that will open a ssh session and enter the password then connect?

Offline jonathon

  • Core Team
  • *****
  • Posts: 2104
  • Technologist - Teacher - Tea drinker
  • Branch: Unstable
  • Desktop: MATE 1.14
  • GPU Card: Nvidia GTX680M
  • GPU driver: Bumblebee nvidia+intel
  • Kernel: 4.6.0-*-MANJARO x86_64
  • Skill: Advanced
Re: remote ssh bash script
« Reply #1 on: 15. February 2016, 14:56:26 »
Yes.


Or do you mean, how do I enter an SSH password within a Bash script? If so, you should look at 'sshpass'. This works perfectly.

Ideally though you should use SSH keys rather than passwords for scripts.
--
MSI GT70: Core i7-3630QM, 16GB, Nvidia GTX680M, Intel 2230, Manjaro-MATE-amd64-EFI
Lenovo X230: Core i5-3320M, 4GB, Intel HD4000, Intel 6205, Manjaro-MATE-amd64
Dell Studio 1749: Core i5 540, 8GB, ATi HD5650, Intel WLAN, Manjaro-Xfce-amd64
Let's go in the garden; you'll find something waiting.

Offline JayGuevara

  • Vollwertiges Mitglied
  • ***
  • Posts: 113
  • I wonder what happens if I do this...
  • Branch: Stable
  • Desktop: Cinnamon
  • GPU Card: GTX650
  • GPU driver: non-free
  • Kernel: 4.4
  • Skill: Novice
Re: remote ssh bash script
« Reply #2 on: 15. February 2016, 21:12:44 »
Ideally though you should use SSH keys rather than passwords for scripts.

I second that. Keys are far more secure. Then you can set up an ssh alias and connect with
Code: [Select]
ssh youralias

Offline optics

  • Jr. Mitglied
  • **
  • Posts: 96
  • ŏp'tĭks
  • Branch: unstable
  • Desktop: ℵfce
  • GPU Card: Intel HD4400 + Radeon HD8550M
  • GPU driver: intel-ati-bb
  • Kernel: 4.6
  • Skill: Novice
Re: remote ssh bash script
« Reply #3 on: 15. February 2016, 23:32:44 »
thanks, I no longer have to enter my password using my SSH key, will check out the ssh alias setup later  >:D

setup my ssh config file for the alias and can now connect to remote server with
ssh go

thank you both.
« Last Edit: 15. February 2016, 23:41:33 by optics »