SSH dari bash script

Pertanyaan umum seputar distribusi Ubuntu yang menjadi distro wajib members ubuntu-indonesia.com
User avatar
culunoop
Posts: 63
Joined: 10 Dec 2010, 10:35
Location: -

SSH dari bash script

Postby culunoop » 15 May 2012, 13:39

Agan2 mau tanyak, klo kita ssh ke server ( dengan password ) tp kita running dengan bash script gimana ya

Teng yu gan
User avatar
ilham2930
Posts: 1123
Joined: 02 Jan 2010, 19:30
Location: /indonesia/tangerang/bonank_city
Contact:

Re: SSH dari bash script

Postby ilham2930 » 15 May 2012, 14:08

$ ssh user_name@alamat_ssh_server -p port_ssh
contoh ;

$ ssh root@1.1.1.1 -p 22
User avatar
buzzing_bee
Posts: 1971
Joined: 29 Dec 2010, 21:53
Location: /home/buzzing_bee
Contact:

Re: SSH dari bash script

Postby buzzing_bee » 16 May 2012, 00:55

Contoh bash script dari kantor :D

Tampilkan

Code: Select all

#!/bin/bash
clear
while :
do
echo "#--------------------#"
echo " [a] SSH to SERVER_1"
echo " [b] SSH to SERVER_2"
echo " [c] SSH to SERVER_3"
echo " [x] EXIT"
echo "#--------------------#"
read pilih
case $pilih in
a) ssh user@ip_address;;
b) ssh user@ip_address;;
c) ssh user@ip_address;;
x) exit ;;
esac
done

User avatar
culunoop
Posts: 63
Joined: 10 Dec 2010, 10:35
Location: -

Re: SSH dari bash script

Postby culunoop » 22 May 2012, 19:28

makasih yo gan
User avatar
buzzing_bee
Posts: 1971
Joined: 29 Dec 2010, 21:53
Location: /home/buzzing_bee
Contact:

Re: SSH dari bash script

Postby buzzing_bee » 22 May 2012, 19:30

bikin aliasnya om di .bashrc biar gampang, ndak usah ngetik command panjang2, misal nama file scriptnya "connect.sh"

bikin alias:
alias c='folder_letak_script/connect.sh'

Return to “Pertanyaan Umum”

Who is online

Users browsing this forum: No registered users and 2 guests