Ubuntu ssh 安卓手机

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

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

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

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

# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 1234
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
#ListenAddress 0.0.0.0

Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin without-password
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile	%h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

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

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

exbot@relay-Aspire-4741:~$ ssh -p 1234 localhost
The authenticity of host '[localhost]:1234 ([127.0.0.1]:1234)' can't be established.
ECDSA key fingerprint is 15:82:ed:f2:0d:52:21:b8:b6:c7:2e:9a:d4:91:a8:0f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[localhost]:1234' (ECDSA) to the list of known hosts.
exbot@localhost's password: 
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 4.4.0-75-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

Your Hardware Enablement Stack (HWE) is supported until April 2019.
Last login: Sun Jan 22 13:14:50 2017
exbot@relay-Aspire-4741:~$ exit
logout
Connection to localhost closed.
exbot@relay-Aspire-4741:~$ ssh -p 1234 192.168.1.101
The authenticity of host '[192.168.1.101]:1234 ([192.168.1.101]:1234)' can't be established.
RSA key fingerprint is b5:9b:9b:5a:c3:1a:cc:e7:c5:10:aa:33:38:21:67:c9.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[192.168.1.101]:1234' (RSA) to the list of known hosts.
SSHDroid
Use 'root' as username
Default password is 'admin'
exbot@192.168.1.101's password: 
u0_a102@hwALE-H:/data/data/berserker.android.apps.sshdroid/home $ ls
u0_a102@hwALE-H:/data/data/berserker.android.apps.sshdroid/home $ cd ..
u0_a102@hwALE-H:/data/data/berserker.android.apps.sshdroid $ ls
app_webview   code_cache    dropbear      home          shared_prefs
cache         databases     files         lib
u0_a102@hwALE-H:/data/data/berserker.android.apps.sshdroid $

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 浅谈安卓apk加固原理和实现

    在安卓开发中,打包发布是开发的最后一个环节,apk是整个项目的源码和资源的结合体;对于懂点反编译原理的人可以轻松编译出apk的源码资源,并且可以修改资源代码、重...

    yuanyi928
  • 笔记——NDK、JNI(十一)

    1、NDK开发(一)————如何在Android Studio下进行NDK开发,文章很好很详细的介绍了NDK

    紫兮木溪
  • 明天下午2点,一加6T迈凯伦版正式发布

    11月28日,一加CEO刘作虎在微博正式宣布,一加与迈凯伦达成战略合作,双方将一起努力将速度推向极致。国内发布会时间则定在12月14日下午14点。

    Zip
  • Android 十年之路: 主屏与导航

    今年是 Android 诞生 10 周年,我们认为是时候回顾一下过去,看看它的演变历程了。很显然,自 2008 年以来这个操作系统发生了巨大的变化,那一年,《暮...

    Android 开发者
  • 2018下半年Android面试历程

    从今年下半年以来就开始在杭州准备简历找工作了,原因基本都懂的,没多少工资,投递简历的渠道是Boss,偶尔也在拉钩上投递,刚开始把简历放到Boss上,就每天都有人...

    用户1269200
  • 爬了6730个微信用户数据,我们发现了这些秘密……

    导读:本文给大家分享一篇从小程序用户使用网络、微信版本、手机型号、屏幕样式、微信字体大小等方面来分析大家的手机使用习惯。

    华章科技
  • Android项目实战(五十二):控制EditText输入内容大小写转换

    今日需求,EditText内容为一串字符串,要求将用户软键盘输入的小写字母在输入的时候自动转为大写字母,反之亦然。

    听着music睡
  • Android代码规范利器: Checkstyle

    Step1: 在 gradle文件夹下创建一个 checkstyle.gradle文件:

    用户1205080
  • 建站四部曲之移动端篇(Android+上线)

    张风捷特烈
  • 优化App冷启动,实现启动页错觉秒开

    APP启动时,界面会首先展示一个白屏或者黑屏,然后再进入欢迎页,稍作停留最后进入APP主页。进程的创建是需要时间的,在创建完成之前,界面是呈现假死状态的,这可能...

    紫兮木溪

扫码关注云+社区

领取腾讯云代金券