Advertisement
Guest User

Untitled

a guest
May 24th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. echo password | ssh id@server
  2.  
  3. $ ssh-keygen -t rsa -b 2048
  4. Generating public/private rsa key pair.
  5. Enter file in which to save the key (/home/username/.ssh/id_rsa):
  6. Enter passphrase (empty for no passphrase):
  7. Enter same passphrase again:
  8. Your identification has been saved in /home/username/.ssh/id_rsa.
  9. Your public key has been saved in /home/username/.ssh/id_rsa.pub.
  10.  
  11. $ ssh-copy-id id@server
  12. id@server's password:
  13.  
  14. .ssh/authorized_keys
  15.  
  16. $ ssh id@server
  17.  
  18. id@server:~$
  19.  
  20. $ sudo apt-get install sshpass
  21. $ sshpass -p your_password ssh user@hostname
  22.  
  23. # ssh-keygen
  24.  
  25. # ssh-copy-id hostname
  26.  
  27. # ssh hostname
  28.  
  29. #!/usr/bin/expect -f
  30. # ./ssh.exp password 192.168.1.11 id
  31. set pass [lrange $argv 0 0]
  32. set server [lrange $argv 1 1]
  33. set name [lrange $argv 2 2]
  34.  
  35. spawn ssh $name@$server
  36. match_max 100000
  37. expect "*?assword:*"
  38. send -- "$passr"
  39. send -- "r"
  40. interact
  41.  
  42. # ./1.ex password localhost ooshro
  43. spawn ssh ooshro@localhost
  44. ooshro@localhost's password:
  45. Linux ubuntu-1010-server-01 2.6.35-25-generic-pae #44-Ubuntu SMP Fri Jan 21 19:01:46 UTC 2011 i686 GNU/Linux
  46. Ubuntu 10.10
  47.  
  48. Welcome to Ubuntu!
  49. * Documentation: https://help.ubuntu.com/
  50. Last login: Tue Mar 1 12:41:12 2011 from localhost
  51.  
  52. #!/usr/bin/perl
  53. use warnings;
  54. use strict;
  55.  
  56. use Net::SSH::Perl;
  57. my $host = 'remote.serv.er';
  58. my $user = 'root';
  59. my $pass = 'hunter2';
  60. my $ssh = Net::SSH::Perl->new('$host');
  61. $ssh->login('$user', '$pass') or die "Oh noes! $!";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement