Linux operation and maintenance tutorial-Linux system remote configuration

Linux system remote configuration

VNC server configuration


Install vncserver to achieve remote control of the linked virtual machine in other computers.

How to view IP address information

  • windows: ipconfig

  • Linux: ifconfig

  • macos: ifconfig




Configure a fixed IP

Set the bridge mode: the virtual machine and the host machine share the same local area network. The virtual machine obtains an IP address on the same network segment as the host machine.

image



Virtual machine IP: 192.168.1.xxx

image



Do not use the root user for remote connection, otherwise the screen will be black.

dnf install tigervnc-server tigervnc-server-module -y

## 添加用户
useradd vncserver
passwd vncserver

##使用 vncpasswd 命令设置其密码,(远程用户)
su - vncserver
$ vncpasswd
Password:
Verify:
Would you like to enter a view-only password (y/n)? n
A view-only password is not used


# vim /etc/systemd/system/[email protected]
[Unit]
Description=Remote Desktop VNC Service
After=syslog.target network.target
[Service]
Type=forking
WorkingDirectory=/home/vncserver
User=vncserver
Group=vncserver
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver -autokill %i
ExecStop=/usr/bin/vncserver -kill %i
[Install]
WantedBy=multi-user.target

By default, the VNC server listens on tcp port 5900+n, where n is the display port number. If the display port number is "1", then the VNC server will listen for its requests on TCP port 5901.

systemctl daemon-reload
systemctl start vncserver@:1.service
systemctl enable vncserver@:1.service
systemctl status vncserver@:1.service

Use this command to view the monitoring status of the port, netstat -anlpt | grep 5901.

## Turn off the firewall 
systemctl stop firewalld
systemctl disable firewalld

setenforce 0 ## temporarily turn off selinux
vim /etc/sysconfig/selinux ## permanently turn off
SELINUX=disabled




VNC client configuration

vnc-viewer download link: https://www.realvnc.com/en/connect/download/viewer/

image

image

image

image






SSH remote connection

SSH is a remote protocol, C/S. We need to install ssh service in the linux system. It is installed by default.

There is no graphical interface installed in the enterprise, and we install it for learning. Linux server basic operating system, desktop operating system. Character interface.

View sshd service status

systemctl status sshd


If you are a windows system, you need to download the ssh client tool. For example, xshell.

ssh username@host address, and then enter the password.

ssh [email protected]

image


Guess you like

Origin blog.51cto.com/15127507/2656575