前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Ubuntu ssh 安卓手机

Ubuntu ssh 安卓手机

作者头像
zhangrelay
发布2019-01-23 13:32:45
2.3K0
发布2019-01-23 13:32:45
举报

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

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

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

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

代码语言:javascript
复制
# 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登陆手机:

代码语言:javascript
复制
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 $
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2017年05月13日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档