Remote Control for linux

Source: Internet
Author: User
Tags ssh port rdesktop
For more information about linux Remote Control-general Linux technology-Linux technology and application, see the following. Learn how to configure the php + apache + mysql environment in linux. I learned how to install the official instal.txt file.

Ssh (putty, secure crt) Remote Management in linux

Remote Control

Activate the ssh port and IP address

During linux installation, the built-in ssh is installed, but it cannot be used directly. You also need to activate it:

Activate ssh:
/Etc/rc. d/init. d/sshd start
Service sshd start
Netstat-tl

After activation, You have to reactivate each time you start the system.

Ssh can be automatically started when linux is started:
Add/usr/sbin/sshd &
(/Usr/sbin/sshd is started by ssh)

In this way, you do not need to activate it again after each boot, and you can directly remotely control it.


Configure the IP Address:
/Etc/sysconfig/network-scripts/ifcfg-eth0

Content:
# Cat ifcfg-eth0 [root @ localhost network-scripts] #
DEVICE = eth0
BOOTPROTO = none
ONBOOT = yes
TYPE = Ethernet
NETMASK = 255.255.255.0
IPADDR = 192.168.0.2
USERCTL = no
PEERDNS = yes
GATEWAY = 192.168.0.1

After Configuration:
/Etc/init. d/network reload or service network

View Nic information: route-n View physical NIC: mii-tool restart eth0: ifup eth0 view eth0 letter

Interest: ethtool eth0 add IP Address: ifconfig eth0 IP netmask subnet mask broadcast address

Linux Remote Control Method Overview


There are several methods:

1. rlogin, rsh, and other r-series commands. Because of the large security risks, it is basically not used up now. So I will not introduce it in detail here.

2. telnet. Telnet can be used in both linux and windows. You only need to open the corresponding service. All telnet data is transmitted in plain text on the network, so there are also security risks. In actual production systems, it is basically not used, but switched to a safer ssh. However, in some cases, such as the internal local area network, telnet is useful. How to Use telnet: for example, to connect to the host foobar

Telnet foobar

You can also directly use the ip Address:

Telnet ip-of-foobar

Enter the user name and password, and connect to foobar.

3. ssh. Ssh is similar to telnet, but data is encrypted on the network before transmission.

Http: // www.linuxaid.com.cn/engineer/brimmer/html/ssh.htm

The article on this link is comprehensive and better than I wrote :)

4. remote X. This utilizes the network transparency of the X Window System, that is, the running and display of graphics programs can be on different hosts. Here, we need to clarify two concepts: X Server and X Client. Assume that the xclock program runs on host A but is displayed on host B. Who is X Server and X Client? A is X Server, B is X Client? Error! The correct answer is that xclock is the X Client and host B is the X Server. Why? Server is the party that provides "resources", while Client is the party that uses "resources. For a window system, "resource" is used to display resources and input devices, such as displays, keyboards, and mouse. Host B provides these resources, and application xclock requests use these resources. Therefore, xclock is the X Client, and host B is the X Server (more specifically, it should be an application on host B, such as/usr/X11R6/bin/X, which controls the allocation and management of these hardware resources on host B ). After clarifying the concepts of X Client and X Server, let's take a look at an important environment variable: DISPLAY, which specifies a DISPLAY device, all graphics programs will display themselves on this device. The DISPLAY format is hostname: displaynumber. screennumber. Hostname is a host name or its IP address. To understand displaynumber and screennumber, we need to know that on some machines, multiple display devices may share the same set of input devices, for example, two CRT monitors are connected to one PC, but they share only one keyboard and one mouse. This set of display devices has a common displaynumber, and each of these display devices has its own screennumber. Displaynumber and screennumber are both numbers starting from scratch. In this way, displaynumber and screennumber are all 0 for common users. Hostname can be omitted (but the colon following it cannot be omitted). If omitted, the local host is used as the default hostname, that is, m. n is equivalent to localhost: m. n. Now we have mastered all the necessary knowledge for using remote X. If we want to run the gimp program on remote host, however, if you want to output the display to the screen of host B, you need to perform the following steps in sequence:

1). Start an X Server program on B
2). Set the appropriate DISPLAY variable on a, for example, export DISPLAY = B: 0.0.
3). Start gimp on.

PS:

1 ). if you cannot use the physical console of A, for example, the physical distance between A and B is very far away, you can use telnet, ssh, and other methods to remotely log on to A for steps 2 and 3, there is no difference.
2 ). note: Because gimp is displayed on B, or it uses X Server on B, A does not need to run an X Server, it does not even have to be installed.
3) Note that B is not required to use a Linux or UNIX operating system, as long as an X Server is run on it. The X Server used in Linux is generally XFree86, which is a free open-source X Server. Microsoft windows also has available X servers, such as X-Win32 and Hummingbird Exceed, but they are mostly commercial software.

You may have noticed a problem. As mentioned above, it seems that an X graphics program can be displayed on any X Server in the network, which will inevitably cause confusion. Therefore, the X Window System provides the permission control command xhost to control which machines can use this X Server. Xhost is easy to use. If you allow the host foo to use my X Server, you can use "xhost + foo". If you do not allow the host foo to use my X Server, you can use "xhost-foo". If you allow any host to use my X Server, simply use "xhost +". Otherwise, "xhost-" will prohibit any host from using my X Server. For more information, see xhost (1 ).

4. vnc (Virtual Network Computing ). VNC is also a c/S architecture, but it is worth noting that if you open A vnc server in session, after the vnc client is connected, session A is also used. In other words, vnc does not start A new session. The most direct result is that if you enable the vnc server in an X session, you will find that, your actions on the local machine (such as moving the mouse or opening a window) will be faithfully reflected in the vnc client. Similarly, if you move the mouse in the vnc client, you will find that the mouse on the local screen will also move accordingly.

In linux, The vnc server program is called vncserver, and the client program is called vncviewer. Start server first:

[Leona @ Ash] $ vncserver

You will require a password to access your tops.

Password:
Verify:

New 'ash: 1 (leona) 'desktop is Ash: 1

Creating default startup script/home/leona/. vnc/xstartup
Starting applications specified in/home/leona/. vnc/xstartup
Log file is/home/leona/. vnc/Ash: 2.log

The vncserver will tell you a identifier, that is

New 'ash: 1 (leona) 'desktop is Ash: 1

In this line, "Ash: 1", "Ash" is the host name of the host running vncserver, and it is no problem to change it to the corresponding IP address; "1" can be considered as the serial number of the started vncserver (actually the displaynumber of X Window) (multiple vncservers can be started at the same time ). If it is the first time you start vncserver, it will ask you to set a password. The vnc client must provide this password when connecting to this server. This password can be modified using the vncpasswd command in the future. After the server is successfully started, you can use the vnc client to connect to it. The identifier of the target server must be provided during connection, that is, the preceding "Ash: 1 ":

[Leona @ Ash] $ vncviewer Ash: 1

Then the password is provided and the session is started.

To disable a vncserver, run the vncserver-kill: id command. The id here is the vncserver serial number.

In windows, there are also vnc server and vnc client (see the attachment ). During installation, you can register the vnc server as a system service. His usage is similar to that in linux. I will not go into details here. Note that the flag serial number field of the vnc server in windows is 0 and is not another value.

5. rdesktop. This is a tool kit in linux. It can connect to Microsoft Windows NT, Terminal Services of Windows 2000, and Remote Desktop of Windows XP ). It is easy to use. Here we use the remote desktop service connected to Windows XP as an example. First, enable the remote desktop service under XP (note that XP's HomeEdition does not have a remote desktop service): Right-click my computer and select Properties to view the Remote tab, select "allow users to remotely connect to this computer" and click "OK. Run rdesktop hostname on the linux machine (before that, make sure that the X Window System has been started). The hostname is the host name or IP address of the windows machine. Now you can log on to the windows server.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.