原始链接:
withebrillianttermuxterminalemulatorappyoucanrunansshserveronyourandroid。
运行服务
youneettoinstalltheopensshpackage
自动安装操作
andusefollowingcommandtostartthesshserver。
sshd
andthereyougo.yoursshserviceisnowrunningonport 8022。
ssh localhost -p 8022
adding your公共密钥
you can ' tdopasswordauthenticationintermux,thereforeyouneedtoputyouropensshpublickeyintothe~~/. ssh/authorized _ keysed
thisfilewillneedtobecreatedandpermissionssetto 600。
touch ~/.ssh/authorized_keys
# Set Permissions to the file
chmod 600 ~/.ssh/authorized_keys
# makesurethefolder.sshfolderhasthecorrectpermissions
chmod 700 ~/.ssh
ifyoudonothaveaopensshkeypairyet,youcangenerateonewithefollowingcommand 3360
ssh-keygen
youmayormaynotenterapassphraseandifyoudon ' tspecifyotherwise,yourkeypairwillhavebensavedunder~~.ssh/id _ rsaand
cat~~/. ssh/id _ RSA.pub~/.ssh/authorized _ keys
chmod 600 ~/.ssh/authorized_keys
thenyoucantestitbyconnectingtoyoursshservice
#-I $ path _ to _ file/filenameisonlyrequirediftheid _ rsafileisnot~~.ssh/id _ RSA
shlocalhost-p 8022-I % path _ to _ key-file %/% name _ of _ key %
youcannowuseyourprivatekey (~/.ssh/id _ RSA )。 tologintoyourtermuxsshserver.simplycopyittoyourcomputer [ CP~/.ssh/id _ RSA/sdcopyingittointernalstoragefirst ]
if you ' reusing OpenSSH (onlinuxorcygwin ) you can use it directly:
#-I $ path _ to _ file/filenameisonlyrequirediftheid _ rsafileisnot~~.ssh/id _ RSA
sh $ IP-p 8022-I % path _ to _ key-file %/% name _ of _ key %
普蒂
if you ' reusingputtyyouwillneedtoconvertittotheputtyprivatekeyformatfirst。
downloadandrunlmdc/ploadtheprivatekey (id _ RSA ) )。
Save the private key as a *.ppk file。
download和run putty
entertheipaddressofyourandroiddeviceanduseport 8022
underconnectionsshauthyoucanbrowseforthe *.PKK文件
Click open
You can leave 'login as:' blank
youshouldnowbeconnectedtoyourandroiddeviceviassh。
If it still doesn't work
sshd -d
ifitisstillpromptsyouforapasswordyoucanentersshd ' sdebugmodewitheabovecommandandseeexactlywhyyyourkeyhasbeenrejected.there neitheryourhomedirectory,your.sshfolderoryourauthorized _ keys文件。
The correct permissions are:
chmod 700 ~
chmod 700 ~/.ssh
chmod 600 ~/.ssh/*
ihopeinthefuturetermuxwillallowustoregistersshdasaproperservicewhichwouldautomaticallystartonsystemboot.rightnowihavethe ' ileandiamusingbzdplaunchtermuxafterboot.youcanalsousethetermuxwidgettoquicklystartshdwithawidget
登录命令:
shissh _ host _ RSA _ key.null-p 8022192.168.43.1