Ubuntu ssh 安卓手机

前端之家收集整理的这篇文章主要介绍了Ubuntu ssh 安卓手机前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Android与linux的关系可以参考这篇博文:

http://blog.csdn.net/u013752202/article/details/53648823

安卓手机可以安装例如:Terminal,SSHDroid等工具。

使用ssh登陆android手机需要注意配置端口:

  1. # Package generated configuration file
  2. # See the sshd_config(5) manpage for details
  3.  
  4. # What ports,IPs and protocols we listen for
  5. Port 1234
  6. # Use these options to restrict which interfaces/protocols sshd will bind to
  7. #ListenAddress ::
  8. #ListenAddress 0.0.0.0
  9. #ListenAddress 0.0.0.0
  10.  
  11. Protocol 2
  12. # HostKeys for protocol version 2
  13. HostKey /etc/ssh/ssh_host_rsa_key
  14. HostKey /etc/ssh/ssh_host_dsa_key
  15. HostKey /etc/ssh/ssh_host_ecdsa_key
  16. HostKey /etc/ssh/ssh_host_ed25519_key
  17. #Privilege Separation is turned on for security
  18. UsePrivilegeSeparation yes
  19.  
  20. # Lifetime and size of ephemeral version 1 server key
  21. KeyRegenerationInterval 3600
  22. ServerKeyBits 1024
  23.  
  24. # Logging
  25. SyslogFacility AUTH
  26. LogLevel INFO
  27.  
  28. # Authentication:
  29. LoginGraceTime 120
  30. PermitRootLogin without-password
  31. StrictModes yes
  32.  
  33. RSAAuthentication yes
  34. PubkeyAuthentication yes
  35. #AuthorizedKeysFile %h/.ssh/authorized_keys
  36.  
  37. # Don't read the user's ~/.rhosts and ~/.shosts files
  38. IgnoreRhosts yes
  39. # For this to work you will also need host keys in /etc/ssh_known_hosts
  40. RhostsRSAAuthentication no
  41. # similar for protocol version 2
  42. HostbasedAuthentication no
  43. # Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
  44. #IgnoreUserKnownHosts yes
  45.  
  46. # To enable empty passwords,change to yes (NOT RECOMMENDED)
  47. PermitEmptyPasswords no
  48.  
  49. # Change to yes to enable challenge-response passwords (beware issues with
  50. # some PAM modules and threads)
  51. ChallengeResponseAuthentication no
  52.  
  53. # Change to no to disable tunnelled clear text passwords
  54. #PasswordAuthentication yes
  55.  
  56. # Kerberos options
  57. #KerberosAuthentication no
  58. #KerberosGetAFSToken no
  59. #KerberosOrLocalPasswd yes
  60. #KerberosTicketCleanup yes
  61.  
  62. # GSSAPI options
  63. #GSSAPIAuthentication no
  64. #GSSAPICleanupCredentials yes
  65.  
  66. X11Forwarding yes
  67. X11DisplayOffset 10
  68. PrintMotd no
  69. PrintLastLog yes
  70. TCPKeepAlive yes
  71. #UseLogin no
  72.  
  73. #MaxStartups 10:30:60
  74. #Banner /etc/issue.net
  75.  
  76. # Allow client to pass locale environment variables
  77. AcceptEnv LANG LC_*
  78.  
  79. Subsystem sftp /usr/lib/openssh/sftp-server
  80.  
  81. # Set this to 'yes' to enable PAM authentication,account processing,# and session processing. If this is enabled,PAM authentication will
  82. # be allowed through the ChallengeResponseAuthentication and
  83. # PasswordAuthentication. Depending on your PAM configuration,# PAM authentication via ChallengeResponseAuthentication may bypass
  84. # the setting of "PermitRootLogin without-password".
  85. # If you just want the PAM account and session checks to run without
  86. # PAM authentication,then enable this but set PasswordAuthentication
  87. # and ChallengeResponseAuthentication to 'no'.
  88. UsePAM yes


----配置完成后,重启sudo /etc/init.d/ssh restart

然后就可以用ssh登陆手机:



  1. exbot@relay-Aspire-4741:~$ ssh -p 1234 localhost
  2. The authenticity of host '[localhost]:1234 ([127.0.0.1]:1234)' can't be established.
  3. ECDSA key fingerprint is 15:82:ed:f2:0d:52:21:b8:b6:c7:2e:9a:d4:91:a8:0f.
  4. Are you sure you want to continue connecting (yes/no)? yes
  5. Warning: Permanently added '[localhost]:1234' (ECDSA) to the list of known hosts.
  6. exbot@localhost's password:
  7. Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 4.4.0-75-generic x86_64)
  8.  
  9. * Documentation: https://help.ubuntu.com/
  10.  
  11. Your Hardware Enablement Stack (HWE) is supported until April 2019.
  12. Last login: Sun Jan 22 13:14:50 2017
  13. exbot@relay-Aspire-4741:~$ exit
  14. logout
  15. Connection to localhost closed.
  16. exbot@relay-Aspire-4741:~$ ssh -p 1234 192.168.1.101
  17. The authenticity of host '[192.168.1.101]:1234 ([192.168.1.101]:1234)' can't be established.
  18. RSA key fingerprint is b5:9b:9b:5a:c3:1a:cc:e7:c5:10:aa:33:38:21:67:c9.
  19. Are you sure you want to continue connecting (yes/no)? yes
  20. Warning: Permanently added '[192.168.1.101]:1234' (RSA) to the list of known hosts.
  21. SSHDroid
  22. Use 'root' as username
  23. Default password is 'admin'
  24. exbot@192.168.1.101's password:
  25. u0_a102@hwALE-H:/data/data/berserker.android.apps.sshdroid/home $ ls
  26. u0_a102@hwALE-H:/data/data/berserker.android.apps.sshdroid/home $ cd ..
  27. u0_a102@hwALE-H:/data/data/berserker.android.apps.sshdroid $ ls
  28. app_webview code_cache dropbear home shared_prefs
  29. cache databases files lib
  30. u0_a102@hwALE-H:/data/data/berserker.android.apps.sshdroid $

猜你在找的Ubuntu相关文章