Project three

Task 1 Configure the Telnet service

Step 1: Mount the CD

       Put the CD into the CD-ROM drive, and then use the [mount /dev/cdrom/mnt] command to mount the CD to the system.


Step 2: Configure the YUM source

[cd /etc/yum.repos.d/] Enter the directory configured by YUM.

[mkdir /etc/yum.repos.d/bak] Create a backup file.

[mv /etc/yum.repos.d/Cent* /etc/yum.repos..d/bak/] Move the original configuration file to the backup folder.

[vim /etc/yum.repos.d/local.repo] Edit your own repo file.


The specific contents of local.repo are as follows:

[local_server] #Library name

name=This ba'seurlis a local repo #name description

baseurl=file:///mnt/ #YUM source address, the mount point of the CD

enabled=1 #Whether to enable the YUM source, 0 is not enabled

gpgcheck=0 GPG=KEY is set to not check

After editing, press the Esc key, enter [:wq] to save and exit.

Step 3: Install client and server software

[rpm -q telnet] Query the client software of Telnet.

[rpm -q telnet-server] Query the Telnet server software. If the installation information of Telnet related software is not queried, you need to use the following commands to install it.

[yum install -y telnet] Install the client software of Telnet.

[yum install -y telnet-server] Install Telnet server software.


Step 4: Modify the main configuration file

Use the [vim/etc/xinetd.d/telnet] command to edit the Telnet configuration file, find the line where disable=yes is located, change it to disable=no, and enable the Telnet function.

(1) Set the maximum number of connections. Add a line after disable=no; instances=4, which means that only 4 users are allowed to connect at the same time, as shown in the figure:

(2) Enable Telnet service on the server.

[/etc/init.d/xinetd restart] or [service xinetd restart] to restart the Telnet service.

[chkcongfig xinetd on] Set the Telnet service to run in the system. As shown in the figure:

 (3) Modify the connection port (default is 23).

[vim/etcrvices] Modify the default port number provided by the server, and change the port number in telnet 23/tcp and telnet 23/udp to a custom port number.

Use the [/etc/init.detd restart] command on the server to restart the Telnet service.

Step 5: Allow root user to log in

Because Telnet transmits data in plain text, including user name and password, data is easily intercepted and tampered with during transmission, so the default root user of the system cannot Tenel to remote On the server, only ordinary users are allowed to Telnet to the remote server. If you need the root user to be able to remotely Telnet to the server, you need to use the [mv /etccuretty /etccuretty.bak] command to comment out the /etccuretty file to make it invalid. Then remotely Telnet to the host as root user.

Step 6: Log in from a third-party client

(1) Use PUTTY to log in remotely. The default port number of Telnet service in the server is 23. If it has been changed to 188, you need to change the port number to 188 when using PUTTY to log in.

(2) Use SecureCRT to log in remotely. Select the protocol as Telnet, fill in the host name of the remote host and the IP address of the remote, and modify the port to 188.
                                                  Task 2 Configure the SSH service

Step 1: Check the installation of SSH software Run

the following command to check the installation of SSH.

[rpm -q openssh] View the installation of the SSH service client.

[rpm -q openssh-server] View the installation of the SSH server.

If the relevant openssh software is not found, please mount the CD-ROM. After configuring the YUM source, you can use the following commands to install it.

[yum install -y openssh] Install the openssh client.

[yum install -y openssh-server] Install the openssh server side.

Step 2: Interpret the main SSH configuration file

The main configuration file for SSH is /etc/ssh/sshd-config, which can be opened with the vim editor.

[service sshd start] Start the sshd service process (under normal circumstances, the letter d after the service name represents the service process).

[chkconfig sshd on] Configure the sshd service to start automatically after the server is powered on.

Step 3: Use third-party software to log in

(1) Use PITTY to log in.

Fill in the host name or IP address of the server to be logged in, use the default port number, and select the SSH service to log in.

After clicking the [Open] button, you will be prompted to enter the user name and password of the server.

(2) Use SecureCRT to log in and log in to the settings interface.

After clicking the [Connect] button, enter the user name and password to log in to the server.

Step 4: Use the [scp] command to transfer files

(1) Start the SSH service on the Linux Server.

(2) Use the [scp LINUXSERVER IP:/directory/file/local directory] command on the client to copy a file on the server to the local directory; the [scp -r LINUXSERVER IP:/directory/local directory] command means to copy the server Copy all files and directories in a certain directory to the local directory; [scp -r 192.168.223.189:/mnt/yhy] command means to copy all files in the mnt directory on the host 192.168.223.189 to the local /yhy directory .

Step 5: Use the [sz] and [rz] commands to transfer the remote host and the local file

[sz] to send the selected file to the local machine.

[rz] Running this command will pop up a file selection window, select the file from the local and upload it to the server.

                          Task 3 Configure the VNC graphical interface service 

Step 1: Install the Gnome graphical desktop

[yum groupinstall "X Window System" "Desktop"] Centos 6.x installs the Gnome desktop environment.

[yum groupinstall Xfce] Install Xfce desktop environment on CentOS, optional.

[yum groupinstall -y "Chinese Support"] Install Chinese support.

Step 2: Install the vnserver software

[yum install -y tigervnc-server tigervnc] to install the vnserver software.

Step 3: Configure the VNC password

[vncserver] Set the VNC password, the password must be more than 6 digits.

[vncpasswd] Modify the VNC password, the password must be more than 6 digits.

Step 4: Configure to use the Gnome desktop

[vim /root/.vnc/xstartup] Open the main configuration file of the gonme desktop, modify the file, delete the last [twm &], and add [gnome-session &] .

Step 5: Configure the listening port and environment parameters

[vim /etc/sysconfig/vncservers] to modify the configuration file after the vncserver is started.

Step 6: Set the vncserver service to run in the system After

modifying any vnserver service, you need to restart the related service.

[service vnserver restart] Restart the vnserver service.

[chkconfig vncserver on] Set vncserver to start automatically when booting.

Step 7: Test login Enter the keyword [VNC Viewer]

in the network to search and download VNC Viewer, and open it after installation.

Enter the IP address of the server, and then click the [OK] button.

Enter the password of the root account and click the [OK] button to log in successfully.

Step 8: Troubleshooting

(1) Check the SELinux service and close it. Use the [vim /etc/selinux/config] command to edit the /etc/selinux/config file, and set the value of the selinux field to [disabled].

(2) Close the NetworkManager service. Use the [chkconfig --del NetworkManager] command to shut down the NetworkManager service.

(3) The iptables firewall will block the VNC remote desktop by default, so it needs to be allowed through iptables. When the VNC service is enabled, you can use the [netstat -tunlp] command to view the ports used by the VNC service, and you can find 5801, 5901, 6001, etc.

Use the [vim] command to edit the /etc/sysconfig/iptables file.

The command to restart the firewall or directly close the firewall is as follows:

[/etc/init.d/iptables restart] Restart the firewall.

【/etc/init.d/iptables stop】Close the firewall.

Step 9: VNC reverse connection settings

Use the [vncviewer -listen] command to start the vnc client, so that the vncviewer is in the listening state, use the [vncviewer] command to start the vncviewer, and use the [vncconnect -display: 1 192.168.223.189 (server IP address)] command to execute the [vncviewer] command on the vncviewer side. , initiate a request from the server to the client.

Step 10: Solve the possible black screen problem

Cause : The user's VNC startup file permissions are not set accurately.

Solution: Change the attribute of the black screen user's xstartup file to 755 (rwxr-xr-x), then kill all the VNC clients that have been started, and use the [vncserver -kill :1] command to kill all the VNC clients that have been started. Terminal 1, use the [vncserver -kill :2] command to kill all the VNC clients that have been started 2, and use the [/etc/init.d/ vnserver restart] command to restart the vnserver service.

Extended training

1. Establish a Telnet server and configure the Telnet server according to the following requirements.

(1) Configure the Telnet service to allow only two connections at the same time.

(2) Configure the Telnet server to listen for client connections on port 2323.

2. Establish an SSH server and configure the SSH server according to the following requirements.

(1) Configure the IP address bound to the SSH server to 192.168.16.177.

(2) Enable public key authentication on the SSH server.

3. Establish a VNC server and configure the VNC server according to the following requirements.

(1) Configure the VNC server to use the Gnome graphical desktop environment.

(2) Configure the VNC service to automatically create a desktop number every time it starts.

(3) Enable the remote assistance function on the VNC server.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324807022&siteId=291194637