Android is indeed a Linux system, but Android is not a standard GNU/Linux distribution. Unlike Raspbian (an ARM architecture Linux distribution based on Debian), you can directly connect to the OpenSSH Server on it through an ssh client. Management.
Of course, many GNU/Linux software can be cross-compiled and used on Android, but because Android does not allow root permissions by default, it is not practical to run OpenSSH Server on Android.
The poster can open a Shell through adb provided in the Android SDK to operate the Android system. First, the poster needs to install the Android SDK on your computer, then connect your Android phone to the computer using USB, and open the "Developer Options" of the Android phone. "USB debugging" in ", and then open this Shell by entering adb shell on the command line.adb shell打开这个Shell.
Of course, the poster may not want to install the Android SDK or connect the mobile phone through USB for management, but wants to manage through the wireless network, then you can try the following workaround. Simply put, run Shell in the browser, The interface is nothing more than a text area for filling in commands, an AJAX run button, the running results are displayed below, and the server (here refers to the Android side) runs the commands entered by the user.
First, install a PHP server on your Android phone, such as listening on port 0.0.0.0:8181, and the website root directory is phpdroid in the SD card. php -S 0.0.0.0:8181 -t /path/ to/sdcard/phpdroid Because Android does not have a firewall, other devices in the wireless LAN can directly access this PHP server through the IP of the Android phone. For PHP, you can use echo shell_exec('ls ');Easily execute commands and return.
I cross-compile and package the Android version of PHP package on Ubuntu, which is called PHPDroid. For details, please see my blog post:
Feasibility Study on Using PHP to Develop Android Applications (PHPDroid)🎜There is a download address of APK and source code at the end of the article.🎜 phpdroid_20160703.apk(5.8M)🎜phpdroid_20160703.7z(4.7M)🎜If you use it, you may need to adjust the startup parameters in start.sh and the authentication mechanism in auth.php.🎜Because my original intention is to develop Android application, so it only listens to the 127.0.0.2 local address, and uses UserAgent to verify that only the WebView of the current application is allowed to access. If the poster needs it, you can notify me to repackage an APK and publish it. 🎜
Android is indeed a Linux system, but Android is not a standard GNU/Linux distribution. Unlike Raspbian (an ARM architecture Linux distribution based on Debian), you can directly connect to the OpenSSH Server on it through an ssh client. Management.
Of course, many GNU/Linux software can be cross-compiled and used on Android, but because Android does not allow root permissions by default, it is not practical to run OpenSSH Server on Android.
The poster can open a Shell through adb provided in the Android SDK to operate the Android system. First, the poster needs to install the Android SDK on your computer, then connect your Android phone to the computer using USB, and open the "Developer Options" of the Android phone. "USB debugging" in ", and then open this Shell by entering
adb shell
on the command line.adb shell
打开这个Shell.当然,楼主可能不想安装Android SDK,也不想通过USB连接手机进行管理,而是想通过无线网络进行管理,那你可以试试下面这个变通的方法.简单说,就是在浏览器里跑Shell,界面无非就是一个文本域textarea用于填写命令,一个AJAX运行按钮,下面显示运行结果,服务器(这里指的是Android端)运行用户输入的命令.
首先,在你的Android手机上安装一个PHP服务器,比如监听0.0.0.0:8181端口,网站根目录为SD卡下的phpdroid.
Of course, the poster may not want to install the Android SDK or connect the mobile phone through USB for management, but wants to manage through the wireless network, then you can try the following workaround. Simply put, run Shell in the browser, The interface is nothing more than a text area for filling in commands, an AJAX run button, the running results are displayed below, and the server (here refers to the Android side) runs the commands entered by the user.php -S 0.0.0.0:8181 -t /path/to/sdcard/phpdroid
因为Android没有防火墙的说法,所以无线局域网内的其他设备可以通过Android手机的IP直接访问这个PHP服务器.
PHP这边可以用
echo shell_exec('ls');
First, install a PHP server on your Android phone, such as listening on port 0.0.0.0:8181, and the website root directory is phpdroid in the SD card.
php -S 0.0.0.0:8181 -t /path/ to/sdcard/phpdroid
Because Android does not have a firewall, other devices in the wireless LAN can directly access this PHP server through the IP of the Android phone.
For PHP, you can use
echo shell_exec('ls ');
Easily execute commands and return.I cross-compile and package the Android version of PHP package on Ubuntu, which is called PHPDroid. For details, please see my blog post:
Don’t Android use adb to interact with the phone
Open developer options, adb shell