Ubuntu ssh 安卓手机

举报
zhangrelay 发表于 2021/07/15 06:03:56 2021/07/15
【摘要】 Android与linux的关系可以参考这篇博文: http://blog.csdn.net/u013752202/article/details/53648823 安卓手机可以安装例如:Terminal,SSHDroid等工具。 使用ssh登陆android手机需要注意配置端口: # Package generated configuration file# See th...

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. # What ports, IPs and protocols we listen for
  4. Port 1234
  5. # Use these options to restrict which interfaces/protocols sshd will bind to
  6. #ListenAddress ::
  7. #ListenAddress 0.0.0.0
  8. #ListenAddress 0.0.0.0
  9. Protocol 2
  10. # HostKeys for protocol version 2
  11. HostKey /etc/ssh/ssh_host_rsa_key
  12. HostKey /etc/ssh/ssh_host_dsa_key
  13. HostKey /etc/ssh/ssh_host_ecdsa_key
  14. HostKey /etc/ssh/ssh_host_ed25519_key
  15. #Privilege Separation is turned on for security
  16. UsePrivilegeSeparation yes
  17. # Lifetime and size of ephemeral version 1 server key
  18. KeyRegenerationInterval 3600
  19. ServerKeyBits 1024
  20. # Logging
  21. SyslogFacility AUTH
  22. LogLevel INFO
  23. # Authentication:
  24. LoginGraceTime 120
  25. PermitRootLogin without-password
  26. StrictModes yes
  27. RSAAuthentication yes
  28. PubkeyAuthentication yes
  29. #AuthorizedKeysFile %h/.ssh/authorized_keys
  30. # Don't read the user's ~/.rhosts and ~/.shosts files
  31. IgnoreRhosts yes
  32. # For this to work you will also need host keys in /etc/ssh_known_hosts
  33. RhostsRSAAuthentication no
  34. # similar for protocol version 2
  35. HostbasedAuthentication no
  36. # Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
  37. #IgnoreUserKnownHosts yes
  38. # To enable empty passwords, change to yes (NOT RECOMMENDED)
  39. PermitEmptyPasswords no
  40. # Change to yes to enable challenge-response passwords (beware issues with
  41. # some PAM modules and threads)
  42. ChallengeResponseAuthentication no
  43. # Change to no to disable tunnelled clear text passwords
  44. #PasswordAuthentication yes
  45. # Kerberos options
  46. #KerberosAuthentication no
  47. #KerberosGetAFSToken no
  48. #KerberosOrLocalPasswd yes
  49. #KerberosTicketCleanup yes
  50. # GSSAPI options
  51. #GSSAPIAuthentication no
  52. #GSSAPICleanupCredentials yes
  53. X11Forwarding yes
  54. X11DisplayOffset 10
  55. PrintMotd no
  56. PrintLastLog yes
  57. TCPKeepAlive yes
  58. #UseLogin no
  59. #MaxStartups 10:30:60
  60. #Banner /etc/issue.net
  61. # Allow client to pass locale environment variables
  62. AcceptEnv LANG LC_*
  63. Subsystem sftp /usr/lib/openssh/sftp-server
  64. # Set this to 'yes' to enable PAM authentication, account processing,
  65. # and session processing. If this is enabled, PAM authentication will
  66. # be allowed through the ChallengeResponseAuthentication and
  67. # PasswordAuthentication. Depending on your PAM configuration,
  68. # PAM authentication via ChallengeResponseAuthentication may bypass
  69. # the setting of "PermitRootLogin without-password".
  70. # If you just want the PAM account and session checks to run without
  71. # PAM authentication, then enable this but set PasswordAuthentication
  72. # and ChallengeResponseAuthentication to 'no'.
  73. 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. * Documentation: https://help.ubuntu.com/
  9. Your Hardware Enablement Stack (HWE) is supported until April 2019.
  10. Last login: Sun Jan 22 13:14:50 2017
  11. exbot@relay-Aspire-4741:~$ exit
  12. logout
  13. Connection to localhost closed.
  14. exbot@relay-Aspire-4741:~$ ssh -p 1234 192.168.1.101
  15. The authenticity of host '[192.168.1.101]:1234 ([192.168.1.101]:1234)' can't be established.
  16. RSA key fingerprint is b5:9b:9b:5a:c3:1a:cc:e7:c5:10:aa:33:38:21:67:c9.
  17. Are you sure you want to continue connecting (yes/no)? yes
  18. Warning: Permanently added '[192.168.1.101]:1234' (RSA) to the list of known hosts.
  19. SSHDroid
  20. Use 'root' as username
  21. Default password is 'admin'
  22. exbot@192.168.1.101's password:
  23. u0_a102@hwALE-H:/data/data/berserker.android.apps.sshdroid/home $ ls
  24. u0_a102@hwALE-H:/data/data/berserker.android.apps.sshdroid/home $ cd ..
  25. u0_a102@hwALE-H:/data/data/berserker.android.apps.sshdroid $ ls
  26. app_webview code_cache dropbear home shared_prefs
  27. cache databases files lib
  28. u0_a102@hwALE-H:/data/data/berserker.android.apps.sshdroid $






文章来源: zhangrelay.blog.csdn.net,作者:zhangrelay,版权归原作者所有,如需转载,请联系作者。

原文链接:zhangrelay.blog.csdn.net/article/details/71774468

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。