Tag Archives: ssh

Kali starts SSH service error [How to Fix]

Kali starts SSH service and resolves error reports

1. Open the SSH configuration file (remember sudo)

sudo vim /etc/ssh/sshd_config

2. #permitrotlogin is changed to

PermitRootLogin yes

That is, remove #, and change the proposal password to yes
3. #passwordauthentication line to

PasswordAuthentication yes

4. Enter after saving and exiting

sudo /usr/sbin/sshd

Errors may be encountered

Missing privilege separation directory: /run/sshd

Solution:

sudo mkdir /run/sshd

Solve host key verification failed [valid]

Host key verification failed

When I wanted to connect to my server on the Mac, I found that there was a problem with my key, so Baidu took a look and made a record.

The first terminal is the picture of the problem, and the second terminal is a code to solve the problem

SSH keygen - R IP address you want to access
SSH keygen - R 192.168.1.5

Reference blog

/usr/bin/ssh-copy-id: ERROR [How to Solve]

When building Hadoop, the domain name is accidentally wrong
which leads to the password input error when configuring password-free login

after modifying the domain name again, the error is always reported in the configuration

Solution:
Modify the wrong domain name in the known_hosts file in the ~/.ssh directory and delete
it directly and execute it again. Command ssh-copy-id slave2 and
enter the password.

[Solved] Vscode Connect to the remote server error: permission denied (public key)

Background

The purpose is to edit the intranet server code locally

However, the springboard machine of the company’s server needs to log in with a key. In addition, there is a dynamic password + personal password. It has not been configured directly with vscode

The termius implementation is borrowed here

How to Solve:

    1. ensure that termius has logged in to the intranet server through the key dynamic password. Use the port forwarding function provided by termius to connect the local XX port to the YY port of the intranet server. Note that the intranet server port here depends on the personal opening. Configure the local ~ /. SSH/config file. For example, the content is as follows
Host local
    HostName 127.0.0.1
    Port xx port
    User Your own username for logging into the server
      1. put a copy of the public key given to you by the company in ~ /.SSH/ and pay attention to these key permissions. Generally, the key is only open to individuals, otherwise an error is reported. For example, permission denied (public key), Chmod 600 ~ /.SSH/* can be executed to change the key files of local and remote servers to only allow individuals to read and write, and the file can be modified locally directly through vscode connection.

 

Qxcbcconnection: xcb error: 148 error while ROS is running rviz

reason:

Because VNC is used to remotely control the lower computer, rviz is a graphics plug-in developed based on OpenGL. Theoretical screen parameters (the tis’ screen) need to be used. Using VNC will lead to incorrect screen parameter values, resulting in rviz errors.

resolvent:

1) Connect the display in the lower computer, and then turn on rviz on the PC enabled with VNC to temporarily solve the problem.

2) Use SSH instead of VNC to control the lower computer remotely. Pay attention to closing the VNC process running in the background, otherwise the core dump problem will occur when running rviz. In addition, due to the impact of network speed, there may be a stuck problem.

Ubuntu18.04 x11vnc failed, report error opening logfile: /var/log/x11vnc.log

Ubuntu 18.04 x11vnc startup failed with error. Opening logfile:/var/log/x11vnc.log

Premise summary error reporting solution

Premise summary

X11vnc was previously installed in Ubuntu 18.04, but it was not connected through VNC view recently. After logging in with SSH, an error was found according to journalctl -u x11vnc

after creating /var/log/x11vnc. Log , view x11vnc.log

report errors

root@VM-16-8-ubuntu:/home/ubuntu# cat /var/log/x11vnc.log | head -n 1000
14/10/2021 10:30:02 passing arg to libvncserver: -rfbauth
14/10/2021 10:30:02 passing arg to libvncserver: /etc/x11vnc.pass
14/10/2021 10:30:02 passing arg to libvncserver: -rfbport
14/10/2021 10:30:02 passing arg to libvncserver: 5900
14/10/2021 10:30:02 x11vnc version: 0.9.13 lastmod: 2011-08-10  pid: 96503
xauth:  unable to generate an authority file name
14/10/2021 10:30:02 -auth guess: using 'XAUTHORITY=/var/run/lightdm/root/:0' for disp='unset'
14/10/2021 10:30:02 XOpenDisplay("") failed.
14/10/2021 10:30:02 Trying again with XAUTHLOCALHOSTNAME=localhost ...
14/10/2021 10:30:02 
14/10/2021 10:30:02 *** XOpenDisplay failed. No -display or DISPLAY.
14/10/2021 10:30:02 *** Trying ":0" in 4 seconds.  Press Ctrl-C to abort.
14/10/2021 10:30:02 *** 1 2 3 4 
14/10/2021 10:30:06 *** XOpenDisplay of ":0" successful.
14/10/2021 10:30:06 
14/10/2021 10:30:06 Using X display :0
14/10/2021 10:30:06 rootwin: 0x2a0 reswin: 0xe00001 dpy: 0xc6786c40
14/10/2021 10:30:06 
14/10/2021 10:30:06 ------------------ USEFUL INFORMATION ------------------
14/10/2021 10:30:06 
14/10/2021 10:30:06 Wireframing: -wireframe mode is in effect for window moves.
14/10/2021 10:30:06   If this yields undesired behavior (poor response, painting
14/10/2021 10:30:06   errors, etc) it may be disabled:
14/10/2021 10:30:06    - use '-nowf' to disable wireframing completely.
14/10/2021 10:30:06    - use '-nowcr' to disable the Copy Rectangle after the
14/10/2021 10:30:06      moved window is released in the new position.
14/10/2021 10:30:06   Also see the -help entry for tuning parameters.
14/10/2021 10:30:06   You can press 3 Alt_L's (Left "Alt" key) in a row to 
14/10/2021 10:30:06   repaint the screen, also see the -fixscreen option for
14/10/2021 10:30:06   periodic repaints.
14/10/2021 10:30:06 
14/10/2021 10:30:06 XFIXES available on display, resetting cursor mode
14/10/2021 10:30:06   to: '-cursor most'.
14/10/2021 10:30:06   to disable this behavior use: '-cursor arrow'
14/10/2021 10:30:06   or '-noxfixes'.
14/10/2021 10:30:06 using XFIXES for cursor drawing.
14/10/2021 10:30:06 GrabServer control via XTEST.
14/10/2021 10:30:06 
14/10/2021 10:30:06 Scroll Detection: -scrollcopyrect mode is in effect to
14/10/2021 10:30:06   use RECORD extension to try to detect scrolling windows
14/10/2021 10:30:06   (induced by either user keystroke or mouse input).
14/10/2021 10:30:06   If this yields undesired behavior (poor response, painting
14/10/2021 10:30:06   errors, etc) it may be disabled via: '-noscr'
14/10/2021 10:30:06   Also see the -help entry for tuning parameters.
14/10/2021 10:30:06   You can press 3 Alt_L's (Left "Alt" key) in a row to 
14/10/2021 10:30:06   repaint the screen, also see the -fixscreen option for
14/10/2021 10:30:06   periodic repaints.
14/10/2021 10:30:06 
14/10/2021 10:30:06 XKEYBOARD: number of keysyms per keycode 7 is greater
14/10/2021 10:30:06   than 4 and 51 keysyms are mapped above 4.
14/10/2021 10:30:06   Automatically switching to -xkb mode.
14/10/2021 10:30:06   If this makes the key mapping worse you can
14/10/2021 10:30:06   disable it with the "-noxkb" option.
14/10/2021 10:30:06   Also, remember "-remap DEAD" for accenting characters.
14/10/2021 10:30:06 
14/10/2021 10:30:06 X FBPM extension not supported.
14/10/2021 10:30:06 X display is capable of DPMS.
14/10/2021 10:30:06 --------------------------------------------------------
14/10/2021 10:30:06 
14/10/2021 10:30:06 Default visual ID: 0x21
14/10/2021 10:30:06 Read initial data from X display into framebuffer.
14/10/2021 10:30:06 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/4096
14/10/2021 10:30:06 
14/10/2021 10:30:06 X display :0 is 32bpp depth=24 true color
14/10/2021 10:30:06 
14/10/2021 10:30:06 Listening for VNC connections on TCP port 5900
14/10/2021 10:30:06 Listening for VNC connections on TCP6 port 5900
14/10/2021 10:30:06 listen6: bind: Address already in use
14/10/2021 10:30:06 Not listening on IPv6 interface.
14/10/2021 10:30:06 
14/10/2021 10:30:06 Xinerama is present and active (e.g. multi-head).
14/10/2021 10:30:06 Xinerama: number of sub-screens: 1
14/10/2021 10:30:06 Xinerama: no blackouts needed (only one sub-screen)
14/10/2021 10:30:06 
14/10/2021 10:30:06 fb read rate: 927 MB/sec
14/10/2021 10:30:06 fast read: reset -wait  ms to: 10
14/10/2021 10:30:06 fast read: reset -defer ms to: 10
14/10/2021 10:30:06 The X server says there are 10 mouse buttons.
14/10/2021 10:30:06 screen setup finished.
14/10/2021 10:30:06 

The VNC desktop is:      VM-16-8-ubuntu:0

******************************************************************************
Have you tried the x11vnc '-ncache' VNC client-side pixel caching feature yet?

The scheme stores pixel data offscreen on the VNC viewer side for faster
retrieval.  It should work with any VNC viewer.  Try it by running:

    x11vnc -ncache 10 ...

One can also add -ncache_cr for smooth 'copyrect' window motion.
More info: http://www.karlrunge.com/x11vnc/faq.html#faq-client-caching

Solution

    after executing x11vnc - ncache 10 according to the error message prompted, 5900 can be monitored normally. At this time, you can connect normally through VNC viewer, but you cannot access it through the original password. View the path to read the password in /lib/SYSTEMd/system/x11vnc. Service . Reset password sudo x11vnc - storepasswd/etc/x11vnc. Pass after restarting x11vnc systemctl restart x11vnc , you can log in with the new password successfully
    `

How to Fix PVE Issues: ERROR: migration aborted

2021-09-24 22:11:47 # /usr/bin/ssh -e none -o 'BatchMode=yes' -o 'HostKeyAlias=st-10' [email protected] /bin/true
2021-09-24 22:11:47 [email protected]: Permission denied (publickey,password).
2021-09-24 22:11:47 ERROR: migration aborted (duration 00:00:00): Can't connect to destination address using public key
TASK ERROR: migration aborted

Enter the failed server
root@st -22:~#

ssh-keygen -t rsa

Retract y to generate public key

View public key

cat /root/.ssh/id_rsa.pub

Copy the public key and edit the public key into authorized_Keys file. Delete the wrong part.

Distribute authorized copies to various servers.

scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/

[error][/usr/share/perl5/vendor_perl/MHA/SSHCheck.pm, ln63] Permission denied (publickey,gssapi-ke

When building mha, the following error was reported when using the masterha_check_ssh script to do ssh communication between the three nodes.

Master: 192.168.0.60 master
backup1: 192.168.0.61 slave1
Backup 2: 192.168.0.62 slave2, while the management node of mha is placed on the second slave

[root@manager mha_master]# masterha_check_ssh –global_conf=/etc/mha_master/mha.cnf –conf=/etc/mha_master/mha.cnf
Sun Sep 26 14:30:23 2021 – [info] Reading default configuration from /etc/mha_master/mha.cnf…
Sun Sep 26 14:30:23 2021 – [info] Reading application default configuration from /etc/mha_master/mha.cnf…
Sun Sep 26 14:30:23 2021 – [info] Reading server configuration from /etc/mha_master/mha.cnf…
Sun Sep 26 14:30:23 2021 – [info] Starting SSH connection tests…
Sun Sep 26 14:30:24 2021 – [error][/usr/share/perl5/vendor_perl/MHA/SSHCheck.pm, ln63]
Sun Sep 26 14:30:23 2021 – [debug] Connecting via SSH from [email protected](192.168.0.60:22) to [email protected](192.168.0.61:22)…
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
Sun Sep 26 14:30:24 2021 – [error][/usr/share/perl5/vendor_perl/MHA/SSHCheck.pm, ln111] SSH connection from [email protected](192.168.0.60:22) to [email protected](192.168.0.61:22) failed!
Sun Sep 26 14:30:24 2021 – [error][/usr/share/perl5/vendor_perl/MHA/SSHCheck.pm, ln63]
Sun Sep 26 14:30:24 2021 – [debug] Connecting via SSH from [email protected](192.168.0.61:22) to [email protected](192.168.0.60:22)…
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
Sun Sep 26 14:30:24 2021 – [error][/usr/share/perl5/vendor_perl/MHA/SSHCheck.pm, ln111] SSH connection from [email protected](192.168.0.61:22) to [email protected](192.168.0.60:22) failed!
Sun Sep 26 14:30:25 2021 – [error][/usr/share/perl5/vendor_perl/MHA/SSHCheck.pm, ln63]
Sun Sep 26 14:30:24 2021 – [debug] Connecting via SSH from [email protected](192.168.0.62:22) to [email protected](192.168.0.60:22)…
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
Sun Sep 26 14:30:25 2021 – [error][/usr/share/perl5/vendor_perl/MHA/SSHCheck.pm, ln111] SSH connection from [email protected](192.168.0.62:22) to [email protected](192.168.0.60:22) failed!
SSH Configuration Check Failed!
at /bin/masterha_check_ssh line 44.
The solution is as follows.

    1. Manually check if the ssh communication between the three nodes is normal , use the format ssh node1 date, each node is executed three times, pay attention to the user who does the ssh communication, for example: I use mysql to do the mutual trust between the three nodes, then we have to switch to mysql to do the check, not the root user
    1. [mysql@slave1 .ssh]$ ssh master date
    1. Sun Sep 26 14:48:30 CST 2021
    1. [mysql@slave1 .ssh]$ ssh slave1 date
    1. Sun Sep 26 14:48:34 CST 2021
    1. [mysql@slave1 .ssh]$ ssh manager date
    1. Sun Sep 26 14:48:38 CST 2021 Use mysql user to execute mutual trust script check, check all ok
    1. Check script.
    1. masterha_check_ssh –global_conf=/etc/mha_master/mha.cnf –conf=/etc/mha_master/mha.cnf
      1. or
    masterha_check_ssh –conf=/etc/mha_master/mha.cnf

[mysql@manager .ssh]$ masterha_check_ssh –global_conf=/etc/mha_master/mha.cnf –conf=/etc/mha_master/mha.cnf
Sun Sep 26 14:29:30 2021 – [info] Reading default configuration from /etc/mha_master/mha.cnf…
Sun Sep 26 14:29:30 2021 – [info] Reading application default configuration from /etc/mha_master/mha.cnf…
Sun Sep 26 14:29:30 2021 – [info] Reading server configuration from /etc/mha_master/mha.cnf…
Sun Sep 26 14:29:30 2021 – [info] Starting SSH connection tests…
Sun Sep 26 14:29:31 2021 – [debug]
Sun Sep 26 14:29:30 2021 – [debug] Connecting via SSH from [email protected](192.168.0.60:22) to [email protected](192.168.0.61:22)…
Sun Sep 26 14:29:31 2021 – [debug] ok.
Sun Sep 26 14:29:31 2021 – [debug] Connecting via SSH from [email protected](192.168.0.60:22) to [email protected](192.168.0.62:22)…
Sun Sep 26 14:29:31 2021 – [debug] ok.
Sun Sep 26 14:29:32 2021 – [debug]
Sun Sep 26 14:29:31 2021 – [debug] Connecting via SSH from [email protected](192.168.0.61:22) to [email protected](192.168.0.60:22)…
Sun Sep 26 14:29:31 2021 – [debug] ok.
Sun Sep 26 14:29:31 2021 – [debug] Connecting via SSH from [email protected](192.168.0.61:22) to [email protected](192.168.0.62:22)…
Sun Sep 26 14:29:31 2021 – [debug] ok.
Sun Sep 26 14:29:33 2021 – [debug]
Sun Sep 26 14:29:31 2021 – [debug] Connecting via SSH from [email protected](192.168.0.62:22) to [email protected](192.168.0.60:22)…
Sun Sep 26 14:29:32 2021 – [debug] ok.
Sun Sep 26 14:29:32 2021 – [debug] Connecting via SSH from [email protected](192.168.0.62:22) to [email protected](192.168.0.61:22)…
Sun Sep 26 14:29:32 2021 – [debug] ok.
Sun Sep 26 14:29:33 2021 – [info] All SSH connection tests passed successfully.
3. If you use root to execute the script, it will report the theme error, remember to switch the user.

[Solved] Vscode Connect SSH Error: Error Running the contributed command ‘_workbench.downloadResource

Question

An error occurred while connecting with vscode error: running the contributed command: '"_ workbench.downloadResource

Solution

Using common online solutions does not solve the problem. The last reason is that the remote network has not been updated for a long time, and the local network has been updated automatically. Therefore, the local vscode cannot be connected to the remote because the remote has not been updated.

I only need to connect the local computer and the remote computer to the same network (must be able to access the Internet), and then use the local vscode to connect to the remote. The remote will automatically update the connected service.

Solutions to remote or adding SSH key errors

 

 

Method 1

ssh-keygen -R XX.XX.XX.XX  

Method 2

【1】 Delete the corresponding IP in known_ Hosts related information

vim /.ssh/known_ hosts

The problem is solved. The reason is that after the system is reinstalled, the remote connection is made again. After entering yes, this opportunity writes the information of the remote machine to/users/Wangdong /. SSH/known_ Hosts file, so if you reinstall the system remotely, you must clean up the machine first.