Article directory
open ssh
Purpose: Open the ssh connection to connect the mobile phone through the computer using the network, and it is more convenient and quick to type commands on the computer.
method:
- Open "Terminal"
- Enter the password you set
- Enter
sudo su root
after entering, then enter the password, it will not be displayed when entering the password, and this interface will be displayed after entering the password and pressing Enter
- Enter
cd ~
to enter the root directory (because this is under the root user, so the entry is the root directory), and it will display like this after typing and pressing Enter
- Enter
mount -o remount rw /
(be careful not to make mistakes, that is a lowercase letter o, not the number 0, and there is a space between rw and /)
- Input
ssh-keygen
, everything that appears:
is for you to enter parameters, we don’t need to enter parameters, just press Enter, until the familiarroot@ubuntu-phablet:~#
- Then enter the command
android-gadget-service enable ssh
, and this interface appears, which means that the opening is successful.
- Input
cp /root/.ssh/id_rsa /home/phablet/Documents/ssh-rsa
(be careful not to make a mistake, the uppercase of the Documents inside should not be lowercase)
- Enter
chmod 777 /home/phablet/Documents/ssh-rsa
, change the file permission to 777, otherwise it will not work later
- Connect the data cable to the computer, double-click to open "This Computer" on the desktop, double-click to open the displayed
Redmi 4X
- Double-click to enter
Redmi 4X
(the one on the left is the TF card I inserted, don't care)
- Double click to enter
Documents
the folder
- Copy
ssh-rsa
the file to your computer and save it
Install Xshell and Xftp software
To connect to the mobile phone through ssh, you need to use the ssh command to operate, but the traditional ssh connection and use are not very convenient, so we use this software to connect and set.
- Open the link: https://www.xshell.com/zh/free-for-home-school/
- Click "Both", and enter your name and your email address (any name, just enter a), click download
- Open the mailbox, find the email he sent to you, click it, there is a download link, click the link to start the download (2 emails, one Xshell, one Xftp, all must be downloaded)
- Open the downloaded installation package to install (both must be installed, it is recommended to install Xshell first)
- Open the software after the installation is complete (after the Xftp installation is complete, just close it)
Use Xshell to connect to the phone
- To connect to a mobile phone, you must first know the IP address of the mobile phone. The method is very simple, open the router management page, enter the password, and find the IP address of the mobile phone
- Set the binding between IP and MAC to prevent the IP from changing when the phone connects to the router next time
- Open the Xshell software, and the "Session" interface will pop up automatically
- Click "New" in the upper left corner
- The name is random, and the IP address is filled in the host
- Click "User Authentication" on the left, enter root as the user name, delete the method
Password
, check itPublic Key
, and selectPublic Key
it to turn blue
- Click "Settings" on the right, then click "Browse"
- Click "Import"
- Select the SSH public key saved to the computer, and click "Open"
- Select the imported public key and click OK
- Click OK, then click OK
- You can see it in the "Session" interface, double-click to start the connection
- The SSH security window will pop up for the first time, click "Accept and Save"
- If this prompt appears when Xshell connects: the selected user key is not registered on the remote host, just enter this command:
cp .ssh/id_rsa.pub .ssh/authorized_keys
Previous: Ubuntu-Touch-02: Start flashing
Next: Ubuntu-Touch-04: Use Xshell and Xftp to configure the phone