Difference between revisions of "Ssh - menjalankan perintah secara remote"
Jump to navigation
Jump to search
Onnowpurbo (talk | contribs) (New page: contoh ssh -l remoteuser remoteserver.com 'mkdir .ssh' ssh -l remoteuser remoteserver.com 'touch ~/.ssh/authorized_keys' cat ~/.ssh/id_dsa.pub | ssh -l remoteuser remoteserver.com 'cat...) |
Onnowpurbo (talk | contribs) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
contoh | contoh | ||
+ | |||
+ | ssh user1@server1 command1 | ||
+ | ssh user1@server1 'command2' | ||
+ | ssh user1@server1 'command1 | command2' | ||
+ | |||
+ | ssh user1@server1 date | ||
+ | ssh user1@server1 'df -H' | ||
+ | ssh root@nas01 uname -mrs | ||
+ | ssh root@nas01 lsb_release -a | ||
+ | |||
+ | ssh -t user@server "time sudo /home/user/script.sh" | ||
+ | |||
+ | Dimana | ||
+ | -t - memberikan akses terminal jika script menanyakan password | ||
+ | sudo - supaya bisa di jalankan sebagai su | ||
+ | |||
+ | ==Copy id_dsa.pub & id_rsa.pub== | ||
+ | |||
+ | Pastikan id_dsa.pub atau id_rsa.pub di copy ke remote server, | ||
ssh -l remoteuser remoteserver.com 'mkdir .ssh' | ssh -l remoteuser remoteserver.com 'mkdir .ssh' | ||
ssh -l remoteuser remoteserver.com 'touch ~/.ssh/authorized_keys' | ssh -l remoteuser remoteserver.com 'touch ~/.ssh/authorized_keys' | ||
cat ~/.ssh/id_dsa.pub | ssh -l remoteuser remoteserver.com 'cat >> ~/.ssh/authorized_keys' | cat ~/.ssh/id_dsa.pub | ssh -l remoteuser remoteserver.com 'cat >> ~/.ssh/authorized_keys' | ||
− | |||
==Pranala Menarik== | ==Pranala Menarik== |
Latest revision as of 20:02, 17 December 2018
contoh
ssh user1@server1 command1 ssh user1@server1 'command2' ssh user1@server1 'command1 | command2'
ssh user1@server1 date ssh user1@server1 'df -H' ssh root@nas01 uname -mrs ssh root@nas01 lsb_release -a
ssh -t user@server "time sudo /home/user/script.sh"
Dimana
-t - memberikan akses terminal jika script menanyakan password sudo - supaya bisa di jalankan sebagai su
Copy id_dsa.pub & id_rsa.pub
Pastikan id_dsa.pub atau id_rsa.pub di copy ke remote server,
ssh -l remoteuser remoteserver.com 'mkdir .ssh' ssh -l remoteuser remoteserver.com 'touch ~/.ssh/authorized_keys' cat ~/.ssh/id_dsa.pub | ssh -l remoteuser remoteserver.com 'cat >> ~/.ssh/authorized_keys'