Android

How to access Android from PC from SSH (via prompt)

Android SSHIf we are computer-savvy users, we know very well SSH, the protocol that allows you to create an encrypted remote session via a command line interface with another computer or device on our home network. This protocol allows a capillary management of all the functions of a device, allowing the user to launch prompt or shell commands even when he is not physically present in the workstation. One of the difficulties that an experienced user of SSH may encounter is being able to use this protocol to connect to a phone to an Android tablet, so as to be able to launch some advanced commands while remaining comfortably seated in front of the PC.

In this guide we will show you then how to access android from pc using ssh, so as to be able to launch advanced commands even without having to unlock the root permissions on the phone (an operation that is always very risky and difficult to perform on modern phones).

READ ALSO: Control Android from PC in 8 possible ways

Connect Android to PC with SSH

Even if we are experienced enough to be able to use SSH commands, we advise you to proceed with great caution: the permissions offered by SSH can lead your Android phone or tablet to malfunction or damage some essential component for starting, so better proceed calmly. How2do assumes no responsibility for damage to property or persons resulting from the improper use of the proposed material.

What can we do with SSH without root

Obviously, if you do not have root permissions on Android, the SSH functionality will be very limited: we can, for example, run commands ls, mkdir, find and a few other commands. Another thing not to be underestimated is the ability to quickly transfer any file from PC to mobile device, without any size limit. Then, if we want to access the advanced features of SSH we must take into account the root of the device, as also seen in the guide How to Root Android to Unlock Cell Phone.

Installare SSH Server su Android

In order to send SSH commands from PC to Android we will need to install an app on the mobile device to speed up access to the protocol; the best from this point of view is without a doubt SSHelper, available for free from the Google Play Store.

SSHerper

Once the app is installed on our device, open it, provide all the permissions that will be requested and, for the initial configuration, immediately go to the tab Configuration. In the new screen we will see the IP address active at that moment for the connection in use and, to finish the configuration, we will have to enter the service port in the editable fields (SSH Server port number), the port for the server log, the port for sharing the notes and choosing an access password (Password). In reality, we can also leave everything as shown by default: the login credentials are admin / admin and we can also make it enough (always if we disable SSH when we are connected outside the home, so as not to offer an easy gateway to hackers!) .

Now that SSH is ready to use on Android we can move on to the PC, the topic of the next chapter.

Access Android SSH from Windows PC

If we are already experts in SSH, you will surely know which program to use for this type of connection: the Command Prompt!

Command Prompt

Once the command prompt is open (we can find it by opening the Start menu and searching for the name prompt) we type the standard command to access an SSH connection:

ssh [email protected] -p 2222

Obviously we modify the command based on the IP address of our Android smartphone and the chosen port number (basic is 2222). After pressing Enter on the keyboard, we enter the SSH password chosen in the previous chapter, so as to immediately have a text shell connected directly to our Android phone or tablet.

If we want to use a third party app to connect to the Android SSH server, the app to download is PuTTY, available for free from the official website.

PuTTY

By downloading this app we will be able to quickly access SSH on Android by typing, in the program interface, the IP address and the port number, choosing the item SSH and finally pressing the key Open down. The login screen will open immediately where you can press the key Yes, enter the username (admin) and the password chosen in the app for Android, so that you can remotely control the device.

How to transfer files with SSH

If we want to take advantage of the SSH protocol to transfer files quickly from PC to Android, we recommend that you use a graphical interface program such as WinSCP, downloadable for free from the official website.

WinSCP

After downloading and installing this program on Windows PC let’s open it, make sure to select SFTP as protocol, we insert the Android IP address, the port number, the username and the password of SSH, press on Log in and confirm where necessary; in a few seconds we will have access to all the folders of the Android file system, so that we can transfer (in a mirror interface) all the larger files without even unlocking the phone or using dedicated programs.

Access Android SSH from Mac

Adding an SSH server on Android will allow you to manage terminal commands even from a Mac or MacBook, without having to install any additional app.

Prompt Mac

To proceed on Mac we open the Launchpad in the dock below, we search and open the app Terminal and type the following command:

ssh [email protected] -p 2222

We adapt the IP address and the port number according to the configuration of the SSH app on Android, we press the button Enter, confirm the issued certificate and enter the access password chosen a few chapters ago, so as to be able to quickly access the advanced features of SSH on Android even when we use a Mac.

Conclusions

Although these procedures are reserved for very experienced users of IT and networks, this does not mean that we cannot try too: very little is enough to start immediately and, once we have learned the basic commands, we will be able to explore the folders, create new ones and move files with a simplicity that is difficult to reach from an app with an interface . For less experienced users there is also WinSCP, which offers a good graphical interface with which to manage all user folders (system folders will be locked unless we unlock root).

To understand what commands to use and how SSH works, we recommend that you read our guides How to use SSH and Linux directories: what are the main folders of each distribution.

Leave a Reply

Your email address will not be published. Required fields are marked *