[tips'n'tricks]SSH Automatic Login using Public Key
Hehehehe .. another sharing again ..
Perhaps almost all engineer know how to do it but .. i think it’s okay for writing it in here since it’s very usefull for others (hopefully).
So lets the tutorial begin then ..
Condition
- Let say you have PC / Laptop (PC-A) at your home and want to connect to your server (Server-A) in your office.
- You’re too tired for always typing your password each time you want to logon to your Server-A.
- You need to implement some script which will be automatically executed remotely from your PC-A to Server-A
So Here it is the steps :
ON YOUR PC-A do the following (assuming your PC-A is *nix based not windows based):
- login to your PC-A with your username and password (let say you use “gundul” as your username for logging in).
- generate your key by issuing this command
ssh-keygen -t rsa
Note : just press Enter if it asks about where to put the file and passphrase as default but if you want to make it more secure just follow the direction that appears.
- your key will be generated in ~/.ssh/id_rsa (this is your private key) and ~/.ssh/id_rsa.pub (this is your public key).
- issue this following command (IMPORTANT !!!!)
chmod 400 ~/.ssh/id_rsa
Note : if you don’t do above command to change the file permission, you will always be asked for password even you already done all this tutorial.
- copy the ~/.ssh/id_rsa.pub from PC-A to SERVER-A under any directory by any way (scp,ftp,whatever).
STEPS ON SERVER-A
- login to SERVER-A with your preferred username and password (let say you use “kampret” as your username for logging in).
- let say you already copy above file to /tmp directory on SERVER-A, now you just need to issue this following command :
cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys
cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys2
chmod 600 ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys2
rm /tmp/id_rsa.pub
DONE !!!
FOR TESTING IT :
- login to your PC-A with “gundul” as username
- ssh to SERVER-A with “kampret” as username
ssh kampret@server-a
you should automatically login without being prompted by password.
So .. once again .. hopefully this tutorial will be helpful.
Any comment ? just drop your question below.
-Superpinjal-
[tips'n'tricks] enable rsh/rlogin in solaris 10
hehehheh .. just want to share .. just in case somebody (perhaps) needs this kind of how to.
Why do we still use rsh for remote command instead of ssh which is more secure ? humm .. perhaps this kind of question will be raised by someone when his / her friend use this kind of command to do the remote command from other machine.
Yeps, that’s true .. ssh is more secure than rsh .. but … there’s special case that some service still needs rsh as a mandatory checlist for it to run normally. In my case .. cacti !!!
Cacti service still needs rsh to pool its data from other machine for it to be able to draw such a statictic graph.
So .. here it is how to enable rsh service in solaris 10 :
Checking whether rsh service up or not by :
telnet target_ip_address 513
if the answer like below :
Trying target_ip_address…
Connected to target_ip_address.
Escape character is ‘^]’.
so it’s fine, i mean the rsh already UP and running, next just need to make sure that you can do remote command with rsh by :
rsh target_ip_address -l username ls (try to list directory through remote command).
if you can see the result .. so it’s fine .. everything it’s fine .. no need to read my next writing.
But if none of above happen .. so .. you need to :
- enable rsh on remote machine by:
svcadm enable svc:/network/login:rlogin --> this is for enabling rlogin
svcadm enable svc:/network/shell:default --> this is for enabling remote shell command
- add in the .rhosts under home directory of target machine like below (to be able to login without password) :
ip_address_or_hostname_from_machine_want_to_login_in username_used_by_machine_want_to_login_in
for example, if i have 2 server :
Server A and Server B.
then Server A with username = super wants to login to Server B with username = kampret
So what you need to do just :
on server B :
- enable rsh and shell/default service as mention in tutorial above.
- login to server B normally with user kampret and then just go to kampret’s home directory and create file with .rhosts as its name and write below on it :
server_A_IP_ADDRESS_or_HOSTNAME super
that’s it … no need for changing something else on server A.
Thank you .. hopefully it will be usefull for everyone.
-SuperpinjaL-
[tips'n'tricks]Skype Status Changer with Amarok Player
Even .. it’s not too important .. but .. it’s such a fun thing when i can see what i’ve played on my Amarok viewed on my skype too instead of just Pidgin.
How to do that ? simple ..
Download this Amarok Script download here
and then .. install it through Amarok by :
open Amarok –> Tools –> Script Manager –> Install Script –> RUN script –> DONE !!!!!
after that .. you can configure it by click on CONFIGURE.
That’s it !!!
[Tips'n'Tricks] Remote Solaris Desktop dari terminal service client Ubuntu / Linux
Kekekekkek .. iseng2 karena bosen ma export display yang cuman bisa 1 export-an tiap server dan ndak bisa barengan untuk beberapa server .. so gw cobain pake terminal service client-nya si ubuntu gw, tapi ternyata XDMCP-nya masih disable .. so perlu di ENABLE in dengan cara :
sudo aptitude install xnest
DONE !!!!
gampang kan ? akhirnya bisa ngerjain banyak server buat install oracle client wuhuuhu .. kenapa ndak dr dulu gw jalanin kaya gini yak ? kekekkekeke
Oh ya .. Ubuntu gw udah HARDY .. kali yang di bawah HARDY .. kudu dikit oprek2 .. ^_^
[Tips'n'Tricks] Logitech Bluetooth Mouse V470 on Ubuntu
Kemaren, gw iseng2 ke ambassador trus muter2 nyari mouse yang ndak ribet ma kabel alias wireless, trus tertarik ama atu yang akhirnya gw beli yaitu Logitech Bluetooth Mouse V470.
Dengan bermodalkan bismillah karena emang officially si tikus ini cuman support MAC ama Windows dan once again Linux jadi anak tiri .. so mulailah coba2 tapi untuk yang satu ini ternyata ndak butuh waktu lama soalnya gw tinggal install gnome-vfs-obexftp dengan cara
sudo aptitude install gnome-vfs-obexftp
trus nambahin di applet-nya Bluetooth di panel di bagian preferences –> service –> input Device (TRUE) dengan device tikus ini (langsung muncul kok, tapi jangan lupa si tikus di ON-in dan CONNECT yak) langsung bisaaa deh .. met mencoba buat yang mo atau udah beli tikus ini.
Any comments ? most welcome.
[Tips'n'Tricks] Mirroring on Solaris
Since, it’s already one of my goal, to share everything related with my knowledges to everyone, so i try to remember everything that i’ve been doing related with my main job as system integrator and when i have some spare time, i will write it down as you can see now.
Here it is one of my scratch book in my brain related with solaris mirroring.
My Server Condition
I have 2 Disk (you can see it with ‘format’ command under root user) :
root@kampret # format
Searching for disks…doneAVAILABLE DISK SELECTIONS:
0. c1t0d0 <SUN146G cyl 14087 alt 2 hd 24 sec 848>
/pci@400/pci@0/pci@8/scsi@0/sd@0,0
1. c1t1d0 <SUN146G cyl 14087 alt 2 hd 24 sec 848>
/pci@400/pci@0/pci@8/scsi@0/sd@1,0
and i have some partition on disk 0 (c1t0d0) :
Part Tag Flag Cylinders Size Blocks
0 root wm 6595 - 9686 30.01GB (3092/0/0) 62928384
1 swap wu 0 - 6594 64.00GB (6595/0/0) 134221440
2 backup wm 0 – 14086 136.71GB (14087/0/0) 286698624
3 home wm 9687 – 11747 20.00GB (2061/0/0) 41945472
4 var wm 11748 – 13808 20.00GB (2061/0/0) 41945472
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 unassigned wm 13809 – 13821 129.19MB (13/0/0) 264576
My plan is to make mirror from root, swap, home and var on disk 0 (c1t0d0) to disk 1 (c1t1d0).
So here it is the action for doing that :
1. Create first new partition on disk 0 for meta database (in my case, i created on slice 7 on disk 0 – c1t0d0s7 with size 128 mb) by issuing :
root@kampret#format
choose disk 0
type “partition” or just “p”
type “print” or just “p”
type “7″
Enter partition id tag[unassigned]: (just ENTER)
continue from last Cylinders + 1 (be careful that slice 2 is not the last cylinders) as starting point
and give it 128mb as its size.
after that just type “label” and continue with yes .. ENTER .. done.
Quit from “format” by CTRL + C
2. Create the disk geometry and partitioning for this mirroring activity with command
prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s – /dev/rdsk/c1t1d0s2
3. Create metadevice database for this partitioning with command
/usr/sbin/metadb -a -f -c 3 /dev/dsk/c1t0d0s7 /dev/dsk/c1t1d0s7
4. Create the mirroring schema :
/usr/sbin/metainit -f d10 1 1 /dev/dsk/c1t0d0s0
/usr/sbin/metainit -f d11 1 1 /dev/dsk/c1t0d0s1
/usr/sbin/metainit -f d13 1 1 /dev/dsk/c1t0d0s3
/usr/sbin/metainit -f d14 1 1 /dev/dsk/c1t0d0s4
/usr/sbin/metainit d20 1 1 /dev/dsk/c1t1d0s0
/usr/sbin/metainit d21 1 1 /dev/dsk/c1t1d0s1
/usr/sbin/metainit d23 1 1 /dev/dsk/c1t1d0s3
/usr/sbin/metainit d24 1 1 /dev/dsk/c1t1d0s4/usr/sbin/metainit d0 -m d10
/usr/sbin/metainit d1 -m d11
/usr/sbin/metainit d3 -m d13
/usr/sbin/metainit d4 -m d14
5. Create the system files for this metadevice :
/usr/sbin/metaroot d0
6. Edit the /etc/vfstab from :
/dev/dsk/c1t0d0s1 - - swap - no -
/dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no -
/dev/dsk/c1t0d0s4 /dev/rdsk/c1t0d0s4 /var ufs 1 no
-
/dev/dsk/c1t0d0s3 /dev/rdsk/c1t0d0s3 /export/home ufs 2
yes -to become like below :
/dev/md/dsk/d1 - - swap - no -
/dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no -
/dev/md/dsk/d4 /dev/md/rdsk/d4 /var ufs 1 no -
/dev/md/dsk/d3 /dev/md/rdsk/d3 /export/home ufs 2 yes -
7. reboot the machine by using “init 6″ or “shutdown -i6 -y -g0″
after the machine started, we continue again and this is the last step.
8. Attach the metadevice to disk 1 as configured before :
/usr/sbin/metattach d0 d20
/usr/sbin/metattach d1 d21
/usr/sbin/metattach d3 d23
/usr/sbin/metattach d4 d24
and if everything fine, you can see that the disk is resync all the contents from disk 0 to disk 1, you can see it by issuing command :
while sleep 5; do echo ” “; /usr/sbin/metastat | grep -i progress; echo ” “; done
and when it reached 100% all .. voilaaaaa … your mirroring activity was DONE and SUCCESSFUL.
Any comments ? most welcome …
NOTE : this howto is really depend on your mirroring scenario and your “format” command result, so just be carefull.
you can copy and paste this scratch everywhere, i just want you to put the source on it as feedback.
[tips n tricks] Jumpstart Server Solaris 10
Sengaja gw mo nulis dalam bahasa indonesia, soalnya yang bahasa inggris udah buanyakk banget dan ini gw tulis dr pengalaman gw selama make ni cara buat nge-deploy solaris di banyak mesin .. alasannya satu .. BIAR NDAK REPOT n NDAK PERLU GANTI2 CD .. kekekekekekek
Mari kita mulai ..
Untuk instalasi solaris pake jumpstart dibagi 2 bagian :
1. Langkah instalasi di SERVER JUMPSTART yang dipake buat nge-boot n install solaris dr SERVER laen yang mo di deploy, dibagi dalam beberapa steps :
a. Install SOLARIS buat si mesin ini dulu (install biasa .. pake CD / DVD media instalasi SOLARIS).
b. Buat direktori untuk flar image dan core jumpstart server trus share 2 direktori ntu pake NFS.
untuk kasus gw, gw bikin direktori /export/home/Jumpstart/FLAR untuk tempat naro FLAR IMAGE dan direktori /export/home/SUN/SOLARIS10.
mkdir /export/home/Jumpstart/FLAR
mkdir /export/home/SUN/SOLARIS10
Sharing 2 direktori ntu dengan menambahkan line dibawah ini ke file /etc/dfs/dfstab
share –F nfs –o ro,anon=0 /export/home/Jumpstart/FLAR
share –F nfs –o ro,anon=0 /export/home/SUN/SOLARIS10
Trus jalankan command
shareall
dari terminal.
c. Install core jumpstart server di direktori yang udah disiapin.
Mount CD / DVD solaris, untuk kasus saya, saya gunakan DVD solaris 10 (otomatis ke mount pas di asupin ke drive)
Jalankan command berikut :
cd /cdrom/cdrom0/s0/Tools
./setup_install_server /export/home/SUN/SOLARIS10
d. Bikin FLAR IMAGE dr SERVER yang mo di jumpstart trus taro hasil FLAR-nya ke direktori yang udah disiapin.
Jalankan command berikut (untuk kasus saya, FLAR dibikin di SERVER JUMPSTART jadi si SERVER JUMPSTART jadi IMAGE buat semua):
flarcreate -n TEST -c -S /export/home/Jumpstart/FLAR/TEST.flar
e. Copy beberapa file yang diperlukan trus taro di direktori yang sama dengan direktori tempat naro FLAR IMAGE.
Jalankan command berikut :
cd /export/home/SUN/SOLARIS10/Misc/jumpstart_sample
cp check /export/home/Jumpstart/FLAR/.
f. Bikin file “sysidcfg” di direktori yang sama dengan direktori tempat naro FLAR IMAGE (/export/home/Jumpstart/FLAR/).
Isi file “sysidcfg” (untuk kasus saya) :
timezone=Asia/Jakarta
timeserver=localhost
terminal=sun-cmd
network_interface=nxge0 {
hostname=superpinjal
default_route=192.168.1.1
ip_address=192.168.1.2
netmask=255.255.255.0
protocol_ipv6=no
}
name_service=NONE
security_policy=NONE
g. Bikin file “rule” di direktori yang sama dengan direktori tempat naro FLAR IMAGE.
Isi file “rule” (untuk kasus saya) :
# <matchrule> <pre-inst> <profile> <post-inst>
any - - flar.prof -
h. Bikin file client profile (klo gw namanya “flar.prof”).
Isi file “flar.prof” (untuk kasus saya, IP ADDRESS JUMPSTART SERVER : 192.168.1.10, cuman ada 4 partisi /, swap, /export/home, /var, DISK yang dikenali dan saya pakai c1t0d0 liat pake command “format”) :
install_type flash_install
archive_location nfs 192.168.1.10:/volA/jumpstart/UIP/UIP.flar
partitioning explicit
filesys c1t0d0s0 30720 /
filesys c1t0d0s1 65536 swap
filesys c1t0d0s3 20480 /var
filesys c1t0d0s4 20480 /export/home
2. Konfigurasi TFTP SERVER
edit file /etc/inet/inetd.conf dan un-comment line berikut :
#tftp dgram udp6 wait root /usr/sbin/in.tftpd in.tftpd -s /tftpboot
sehingga menjadi
tftp dgram udp6 wait root /usr/sbin/in.tftpd in.tftpd -s /tftpboot
khusus untuk SOLARIS 10, jalankan command berikut untuk mendaftarkan XML tftp service ke svc daemon
inetconv -i /etc/inet/inetd.conf
dan START tftp server (pastikan ada process tftp setelah start dengan “ps -edf |grep -i tftp”).
3. Konfigurasi /etc/ethers dan /etc/hosts sesuaikan dengan SERVER yang mau diinstall pake cara JUMPSTART.
Untuk kasus saya, client yang akan di install menggunakan jumpstart server memiliki MAC ADDRESS : 0:9:3d:14:87:9 dan IP ADDRESS : 192.168.1.20 dengan hostname “GUNDUL”, maka
Isi file /etc/hosts
192.168.1.20 GUNDUL
192.168.1.10 JUMPSTART
Isi file /etc/ethers
0:9:3d:14:87:9 GUNDUL
0:21:28:4:67:50 JUMPSTART
4. Jalankan command “add_install_client” di SERVER JUMPSTART (untuk kasus saya, SOLARIS saya pake sun4v, cara liatnya tinggal “uname -a” aja .. liat disitu deh).
./add_install_client \
-s JUMPSTART:/export/home/SUN/SOLARIS10 \
-c JUMPSTART:/export/home/Jumpstart/FLAR/ \
-p JUMPSTART:/export/home/Jumpstart/FLAR/ \
GUNDUL sun4v
5. Langkah di sisi SERVER yang mo diinstall solaris pake cara JUMPSTART server.
init 0 (untuk masuk ke OBP)
setelah udah masuk ke OBP ketikkan :
boot net – install
ikuti petunjuk apapun .. dan tunggu sampe selesai, klo ada error .. silahkan bertanya lebih lanjut ke dokter terdekat .. kekekekkkeke
Nuhun ..
TRIP TO UJUNGKULON (15 – 18 Agustus 2008)
Insyaalloh trip ini lancar dan berhasil, bareng ma temen2 baru di multiply .. blum pernah ketemu muka tapi udah kebayang serunya .. Best Way to release all of this damn thing in my head !!! hopefully i will be more fresh after this ..
☼ AKOMODASI & BIAYA:
- Bis with AC & TV from Jakarta to Sumur PP
- Kapal Sumur to P. Peucang PP
- Tiga buah Kamar Paviliun di P. Peucang
- Dua buah Rumah Paviliuin di Sumur
- Makan 7x
- Boat ke tujuan Snorkeling & Tj. Layar
- Tiket masuk Peucang, Tj. Layar, Cidaon, Kr. Copong
☼ ITINERARY:
Jumat / 15 Agustus 2008
20.00 Kumpul di Parkit Senayan (yang punya baju TW dipake ya)
21.00 Brangkat ke Sumur
Sabtu / 16 Agustus 2008
04.00 Tiba di Sumur – Beres-beres, Ishoma, Sarapan
07.00 Berangkat menuju Peucang
10.00 Tiba di Peucang – Beres-beres, pembagian kamar
11.00 Menuju Tanjung Layar
11.30 Tanjung Layar, Makan Siang, Jalan Jalan
14.00 Back to Peucang
14.30 Istirahat, snorkeling, foto-foto, jalan jalan, bebas
16.00 Menuju Karang Copong
17.00 Tiba di Karang Copong – Sunsetting
18.30 Back to Peucang
19.30 Bersih-bersih, makan malam
21.00 Acara bebas, Istirahat – Main-main di dermaga, tiduran atau main kembang api
Minggu / 17 Agustus 2008
05.00 Bangun, shalat
06.00 Sarapan
07.00 Menyebrang ke Cidaun – Nonton Banteng bersantai
08.30 Tiba kembali di Peucang – Snorkeling ke Citerjun
10.00 Upacara 17-an pake putih-putih/batik – Games
12.00 Makan Siang, Ishoma
13.00 Brangkat menuju Sumur
15.00 Mampir P. Handeleum
16.30 Menuju Sumur lagi
18.00 Tiba di Sumur – Beres-beres, bersih-bersih, Ishoma
19.30 Bakar Ikan, Makan malam
21.00 Acara Bebas, Istirahat
Senin / 18 Agustus 2008
05.00 Bangun, bersih-bersih, shalat
06.00 Sarapan
07.00 Trekking ke Goa Lalay
12.00 Istirahat, Makan siang (kita beli di luar aja, bs – bs) Ishoma
13.00 Kembali ke Jakarta (lewat Bogor)
15.00 Mampir makan di Bu Ntin (optional – bs bs)
20.00 Tiba di Jakarta
Nyang Masih Kudu gw lengkapin
- Sunblock –> kayanya ndak gw bawa .. biar lebih kerasa jalan2nya.
- Obat-obatan pribadi
- Alat Snorkeling –> kudu beliiiiii
- Baju putih-putih buat Upacara 17-an seadanya dan batik untuk kita pake seharian tanggal 17
–> haduhhh
kita berencana akan mengibarkan bendera merah putih geda di Peucang dan upacara kecil diiringi lagu Indonesia Raya, trus maen games 17-an sebentar just for fun dan dapetin momen seru rame rame
MERDEKA !!!!!
At last .. my aptitude issues FIXED
After i browsed everywhere .. now i’ve fixed my aptitude packages ..
Actually the problem persist after i remove my squid installation from my laptop (some bugz on aptitude i think .. already raised a call to launchpad) and then .. whenever i installed everything by aptitude / apt-get command, my HARDY always complaint like below :
…
update-rc.d: /etc/init.d/squid: file does not exist
invoke-rc.d: unknown initscript, /etc/init.d/squid not found.
dpkg: error processing squid (–configure):
subprocess post-installation script returned error exit status 100
Errors were encountered while processing:
squid
E: Sub-process /usr/bin/dpkg returned an error code (1)
……
but i still can’t fix it by implementing all suggestion that i found from all website which related with this.
So .. i tried by myself, since i found this line “/etc/init.d/squid: file does not exist” so i just try the dummy way by
1. touching an empty file as root “sudo touch /etc/init.d/squid”, then after that ..
2. removing squid installation by “sudo aptitude remove squid” and voilaaaaaaaaaaaaaaaaa .. everything fine now ..
Buhuhuhhuuh .. hope everyone that having similar problem can fix it by reading this scratch pad.
So Sad .. My Rebellion Soul Raised Again
Udah seminggu ini bener2 hectic abis .. totally gw mecahin record sendiri buat sesuatu yang mungkin disebut ma orang laen “too much workaholic (kurang apa coba .. udah holic + too much lagi)” tapi buat gw challenges coz i love when i found root cause of some problem especially when its related with my profession.
Tapi bukan disitu masalahnya .. bukan disitu intinya ..yang mo gw bilang disini .. klo orang2 bule ntu bener2 bisanya tereak doank .. dan nyuruh sesuatu yang sbnrnya bukan capability dr tim nya .. masa engineer suruh ngadep bos gedenya client buat jelasin masalahnya .. bukannya dia yang officially bilang wuhuhuhu .. ini yang terjadi ma DBA expert dr tim gw skr .. dan kasus laen lagi .. setelah gw dapetin root cause-nya dan di follow up dengan mantab ama pakde yang selalu bantu gw buat loncat2 kerja (at least di 2 kerjaan skr .. kekekeke) yang emang top abis klo udah urusan scripting n coding, pakde gentho, juga disikat ampe ada anceman segala gara2 ngebenerin code dr aplikasi yang berjalan (udah di test dan berjalan dengan MANTABBSSS) .. wuhuhuh padahal tim yang skr bener2 udah nunjukin capability sebagai great team .. ampe nyelsein CASE GEDE di salah satu operator di indonesia yang gak kelar2 dengan cepat, baek, terplanning, terdokumentasi padahal blum juga dapet official training yang akhirnya malah dapet ucapan TERIMAKASIH dr Client .. bukan dr management sendiri .. DAMN!!!!
Tapi .. kadang emang kita kudu ikhlas .. semua pasti ada hikmahnya .. kaya yang dibilang ma emak gw
kerja itu diniatin buat ibadah yo le .. ojo ngarep soko menungso .. kerjo sing bener niat karena Alloh SWT .. mesti awakmu entuk hasile .. eling ..
Yups .. mungkin udah saatnya untuk bener nerapin itu .. soalnya klo dipikir2 .. salah satu alasan kenapa gw sering loncat2 .. karena gw paling sepet ma environment yang gak bisa menghargai even dengan sekutip kata2 TERIMAKASIH.
Bismillah .. moga kuat .. tapi ..
.. Mas Onnnnn .. klo sampeyan pindah ikutttttttttttttttttttttttttttttttt .. kekekekekkeke