Next: Auto-save and Backup, Previous: Remote shell setup, Up: Configuration [Contents][Index]
Android devices use a restricted shell. They can be accessed via the adb method. However, this restricts the access to a USB connection, and it requires the installation of the Android SDK on the local host.
When an sshd
process runs on the Android device, like
provided by the SSHDroid
app, any ssh-based method can
be used. This requires some special settings.
The default shell /bin/sh
does not exist. Instead, you shall
use just sh
, which invokes the shell installed on the device.
You can instruct TRAMP by this form:
(add-to-list 'tramp-connection-properties (list (regexp-quote "192.168.0.26") "remote-shell" "sh"))
with ‘192.168.0.26’ being the IP address of your Android device (see Predefined connection information).
The user settings for the PATH
environment variable must be
preserved. It has also been reported, that the commands in
/system/xbin are better suited than the ones in
/system/bin. Add these setting:
(add-to-list 'tramp-remote-path 'tramp-own-remote-path) (add-to-list 'tramp-remote-path "/system/xbin")
If the Android device is not ‘rooted’, you must give the shell a writable directory for temporary files:
(add-to-list 'tramp-remote-process-environment "TMPDIR=$HOME")
Now you shall be able to open a remote connection with C-x C-f
/ssh:192.168.0.26#2222:, given that sshd
listens on port ‘2222’.
It is also recommended to add a corresponding entry to your ~/.ssh/config for that connection, like
Host android HostName 192.168.0.26 User root Port 2222
In this case, you must change the setting for the remote shell to
(add-to-list 'tramp-connection-properties (list (regexp-quote "android") "remote-shell" "sh"))
You would open the connection with C-x C-f /ssh:android: then.
Next: Auto-save and Backup, Previous: Remote shell setup, Up: Configuration [Contents][Index]