Remote control

VNC is a screen output to your Linux software on another computer, SSH now you sucked on Terminal link computers Linux Terminal, using code control Linux. SSH is an encrypted communication channel, but also to ensure your safety. SSH will use more smoothly (VNC desktop image will output card).

From MacOS or Linux via SSH remote Linux

1, to Linux install OpenSSH

In order to achieve the SSH function, you have to determine is installed SSH service on your Linux, generally may not be installed. So we will have to install an open source SSH tool, called OpenSSH, your Linux becomes a server (that is, like you as you visit the site visit of Linux). open your Terminal on Linux, then enter the following sentence to install openssh-server, sudousing administrator privileges mean, so after a carriage return it may require you to enter your user password

$ sudo apt-get install openssh-server

If you have not previously installed, terminal will prompt you will have many things to be installed, you need to confirm. After confirmation is over, it will help you continue the installation.

2, Mac or Linux SSH to Linux

Now your Linux is a state that can be logged in the SSH. We start with MacOS or Linux you another remote Linux start this because MacOS and Linux systems are similar, so the operation is simpler than Windows.

I have a Mac, so use a Mac demo specific operations, this operation and you use the Linux operating SSH is the same as you only need to open Terminal on your Mac and enter..:

$ ssh [要控制的用户名]@[它的IP地址]

For example, I use a mac to manipulate the user name Linux called morvan, morvan this linux's ip address may get this . First of all, back to the control of Linux, make sure you control two computers and manipulated connection on the same router. then enter this acquire control computer ip number on you being manipulated computer terminal.

$ ifconfig

If you have not installed it prompts ifconfigyou to press its demands like installation, enter the following command can be installed:

$ sudo apt install net-tools

To ensure that ifconfigafter use, input ifconfig, and then find the words that begin with inet, this is the route you're in the ip address. For example, I now ip is192.168.0.114

inet addr:192.168.0.114

Find a good ip (192.168.0.114), you know the computer's user name to be manipulated (morvan), now back to the control computer terminal (my Mac). Ssh command at the beginning of the previously mentioned input terminal Then it it will ask you to enter manipulated Linux user passwords. it is clear that only people who know the password to login to your Linux, otherwise it is too easy to be black.

$ ssh [email protected]
[email protected]'s password:

Note: You may have to try this in a direct way ssh failure like me, just an upgraded version of the 16 Ubuntu to version 17, the Mac for some reason I do not let me go ssh version 17 Ubuntu, shows the following error. and later checked and found a solution.

ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
ERROR: Someone could be eavesdropping on you right now (man-in-the-middle attack)!
........
ERROR: ECDSA host key for 192.168.0.114 has changed and you have requested strict checking.
ERROR: Host key verification failed.

If you see this error above, the direct terminal running on your computer (on my Mac) the following:

$ ssh-keygen -R 要 ssh 去的 ip 比如下面这样
$ ssh-keygen -R 192.168.0.114

After the return to normal, then press the above steps ssh to Ubuntu. Enter, confirm the password, you control the computer terminal will instantly become manipulated the computer terminal of friends. He will show some of this information to prove that you log in successfully. Now you can use the free Linux previously learned commands, remote control Linux computers it on your computer.

Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-96-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

147 packages can be updated.
53 updates are security updates.

Last login: Sun Oct 15 00:21:56 2017 from 192.168.0.104
morvan@morvan-Latitude-E5550:~$

3, omit the password to log

But you can go further, you now login once every SSH Linux, are required to enter a password if you login attempts are frequent, but your password has set very long, which is very troublesome. Fortunately, we can advance set a "confidentiality agreement" to allow you to identify which of the Linux computer can log on without a password. this is public/private rsa key.

We will Mac or Linux (control computer) is generated on a public/private keypair(public and private) and public key (public key) copied to the remote Linux to be so when you have the private key of the control computer to remote control this station has a public key of Linux, he will help you identify the pair. do not need to be entered every time the remote computer password.

So first we still use my Mac demo, enter the command in the Terminal on mac ssh-keygento create public and private keys, where it will prompt you to save the locks. We will use it to default better place. So enter OK.

$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/MorvanZhou/.ssh/id_rsa):

OK, it will pop up the following, you should determine whether you want a protection password, if you know your local area network is secure, this can not fill. I will not fill, so I hit enter.

Enter passphrase (empty for no passphrase):

Then it will ask you to confirm again, enter

Enter same passphrase again:

Finally, it will show something like this to tell you that your locks have generated good.

Your identification has been saved in /Users/MorvanZhou/.ssh/id_rsa.
Your public key has been saved in /Users/MorvanZhou/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:yVr3PAPmxVO1lBd7KvqBsBCZSE8mdYce8mjBiUfRDVE MorvanZhou@Morvan
The key's randomart image is:
+---[RSA 2048]----+
|    o=*++*E    o+|
|   ..**++..   .o+|
|    ..=* .    .oo|
|      ooo. . . ..|
|     .. S + = .  |
|       + * B o   |
|      . . + *    |
|           . +   |
|            .    |
+----[SHA256]-----+

Next, we will generate good will this "public key" to copy to your Linux to be controlled. Command structure is the same as above.

$ ssh-copy-id [被控制的用户名]@[它的ip]

I was controlled by Linux users called morvan, his IP, I passed the manner described above to find. So I entered this below. Enter after he will ask you to enter a password controlled side of the computer.

$ ssh-copy-id [email protected]

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/Users/MorvanZhou/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]'s password:

After the password is correct, it outputs, and tell you how to use ssh to log the controlled side of the computer.

Number of key(s) added:        1

Now try logging into the machine, with:   "ssh '[email protected]'"
and check to make sure that only the key(s) you wanted were added.

Finally, we have a happy heart computer in Mac / Linux ssh controlled it - the login time is not required to enter any password -

$ ssh [email protected]

Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-96-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

147 packages can be updated.
53 updates are security updates.

Last login: Mon Oct 16 08:36:26 2017 from 192.168.0.111

Linux via SSH remotely from Windows

1, to install Linux OpenSSH
2, Windows software PuTTY SSH

On Windows, SSH is not as commonly used Linux and MacOS, and Windows systems and Linux kernel is also not the same. So we use software to achieve a more appropriate SSH. PuTTY is an open source, free, and often use SSH software first, we have to download the software.

After installing, find the Start menu PuTTY, and open PuTTY, you will see the following. Then the "Host name (or IP address)" fill that controlled the Linux IP.

Click the Open button, you will be able to log on Linux you, it will jump out of a small window, allowing you to confirm this computer is not what you want to link to a computer. If you are in your own home LAN, do not worry about security issues, direct point Yes like.

From the phone (Android Android / IOS Apple) by SSH remote Linux

1, to install Linux OpenSSH
2, app phone SSH's
Android app, there are a lot of ssh Apple certainly a lot. In fact, you just use the "SSH" Soso app store inside. Inside there will be a lot of available app. I to "JuiceSSH" for example. It should be the other are similar.
Download good "JuiceSSH". you open this app, if you have not created any ssh link you will need to click the "connections", their own to create a connection.
the next step in the only thing we require is that you want to connect to, ssh to the IP address.
ip address intact on the "address" in this column. then click OK to add that hook the upper right corner of the connection.
after determining that it will jump out a window that lets you confirm whether you computer on to connect to a computer on what you really want to connect. If under your router in your home, do not worry, others difficult to black got you. If the next you're in a public route you still have to repeatedly check, get free time to be hacked.
then enter your Linux computer is the user password. after confirming you will be able to use ssh normal controls on cell phone Your Linux computer.

With TeamViewer and VNC remote control from a computer

VNC or Teamviewer this tool is to provide you with a remote graphical desktops. They are all third-party software.

1、TeamViewer

Teamviewer fact, has developed very mature. It is a cross-platform remote control software. Windows, MacOS, Linux, can be downloaded using a mobile phone. It will pass outside the network, your computer desktop projected to be controlled to control your computer on. However, fluency, speed greatly depends on your network speed. If you want to do a small scale, control LAN (computers are in the same routing) computer. VNC I think it is a little faster, because it does not go outside the network. of course, the fastest SSH or friends, do not have the output image, the code directly control it.

2、VNC

In fact, collectively VNC is a piece of software long as you are a good set up Linux server (Server) of VNC, client, such as your Mac, mobile phone, just install any VNC client software on the server will be able to link computers If you happen to have friends a raspberry Pi (raspberry Pi), will use VNC is very useful to you then first, we have to set the bar open VNC server on your Linux computer, open terminal input....:

$ sudo apt-get install x11vnc

Linux user confirm your password, you can install the most commonly used software x11vnc friends. Using this software, the setup is very simple. After installation, it is best to give your x11vnc set a password. When I do not set a password, but also with Mac not on board, be sure to complete the password, use the password to log on Linux VNC server can be.
so to set a password process is so in your Linux Terminal enter the following, then it will prompt you to enter the password you want, this password is when connecting to VNC, log on with.

$ x11vnc -storepasswd

Enter VNC password:
Verify password:
Write password to /home/morvan/.vnc/passwd?  [y]/n y
Password written to: /home/morvan/.vnc/passwd

After setting up, enter the following command in your Linux terminal, the form requires a password to open the VNC server.

$ x11vnc -usepw

If you are using ubuntu 17.10, as of the current (October 27, 2017) for VNC there is no fix a bug, so this problem occurs below 17.10 version of Ubuntu if you try the above way, you have to try Next, a method to say.

X Error of failed request: BadMatch (invalid parameter attributes)
  Major opcode of failed request: 73 (X_GetImage)
  Serial number of failed request: 41
  Current serial number in output stream: 41

First question, I looked for a long time, finally found a new version of ubuntu desktop display upgrade, seems to be turned into 3D, then previous 2D form x11vnc do not support, so we want to change the form of the desktop. The first thing is logout of your computer. in the upper right corner of the desktop, choose with your users, and then logout.
then select a different desktop mode (Xorg) login ubuntu. As a result, if we repeat the above x11vnc startup mode, you will not will the error.

Finally, if there is frequently out of x11vnc phenomenon, try this out in the open when x11vnc directly and let it run forever.

$ x11vnc -usepw -forever

3, Mac with VNC connection

After the turn finished, use the Mac to connect to the VNC Linux is very convenient, the Mac, there is a software called Screen Sharing. Open it and enter your Linux in the LAN IP address (you can enter ifconfig found in Linux). Point Connect, Finally, enter the VNC password you just set, you will be able to connect to it

4, with the Linux VNC connection

Linux, there is a VNC software that comes with it. As long as what you found in the upper right corner "VNC", that was my out lap software is a side VNC Client. Point to open it, enter the server IP and end his password like .
Here Insert Picture Description
5, with Windows VNC connection

As Windows does, in fact, there are many options, we have set up a VNC server on the Linux side on the Windows side, we just need a VNC client and there are many software can achieve VNC client this function I have listed some below...: TightVNC (free), RealVNC (free)

RealVNC There are two options, one is the VNC Viewer, used for client-side (control). One is the VNC connect, used for server-side (controlled).

VNC Client-side operating procedures are simple. To only requires a server-side IP and his password just fine.

Source: Mo trouble python

Published 33 original articles · won praise 1 · views 1226

Guess you like

Origin blog.csdn.net/weixin_44783002/article/details/105090494