当前位置:网站首页>Clion configuring WSL tool chain
Clion configuring WSL tool chain
2022-07-24 19:11:00 【Guojianhua】
List of articles
Preface
When we use CLion when , If installed locally Linux Subsystem ( Such as Ubuntu), Want to use WSL Tool chain , but Credentials Has been an error , At this time, you can use the following solution .
If you haven't installed WSL, You can refer to the official tutorial : Use WSL stay Windows Installation on Linux
Solution
In your Ubuntu In any directory , Copy the following into a script ( For example, the file name is ubuntu_setup_env.sh), And then execute .
#!/bin/bash
set -e
SSHD_LISTEN_ADDRESS=127.0.0.1
if [ -e "/dev/vsock" ]; then # in case of WSL2
SSHD_LISTEN_ADDRESS=0.0.0.0
fi
SSHD_PORT=2222
SSHD_FILE=/etc/ssh/sshd_config
SUDOERS_FILE=/etc/sudoers
# 0. update package lists
sudo apt-get update
# 0.1. reinstall sshd (workaround for initial version of WSL)
sudo apt remove -y --purge openssh-server
sudo apt install -y openssh-server
# 0.2. install basic dependencies
# sudo apt install -y cmake gcc clang gdb valgrind build-essential
# 1.1. configure sshd
sudo cp $SSHD_FILE ${SSHD_FILE}.`date '+%Y-%m-%d_%H-%M-%S'`.back
sudo sed -i '/^Port/ d' $SSHD_FILE
sudo sed -i '/^ListenAddress/ d' $SSHD_FILE
sudo sed -i '/^UsePrivilegeSeparation/ d' $SSHD_FILE
sudo sed -i '/^PasswordAuthentication/ d' $SSHD_FILE
echo "# configured by CLion" | sudo tee -a $SSHD_FILE
echo "ListenAddress ${SSHD_LISTEN_ADDRESS}" | sudo tee -a $SSHD_FILE
echo "Port ${SSHD_PORT}" | sudo tee -a $SSHD_FILE
echo "UsePrivilegeSeparation no" | sudo tee -a $SSHD_FILE
echo "PasswordAuthentication yes" | sudo tee -a $SSHD_FILE
# 1.2. apply new settings
sudo service ssh --full-restart
# 2. autostart: run sshd
sed -i '/^sudo service ssh --full-restart/ d' ~/.bashrc
echo "%sudo ALL=(ALL) NOPASSWD: /usr/sbin/service ssh --full-restart" | sudo tee -a $SUDOERS_FILE
cat << 'EOF' >> ~/.bashrc sshd_status=$(service ssh status) if [[ $sshd_status = *"is not running"* ]]; then sudo service ssh --full-restart fi EOF
# summary: SSHD config info
echo
echo "SSH server parameters ($SSHD_FILE):"
echo "ListenAddress ${SSHD_LISTEN_ADDRESS}"
echo "Port ${SSHD_PORT}"
echo "UsePrivilegeSeparation no"
echo "PasswordAuthentication yes"
Be careful : I annotated one more line of command in the script , As shown below . these C/C++ The compilation tool of is installed according to your own needs , The script does not force you to install , Install according to your own needs .
# 0.2. install basic dependencies
# sudo apt install -y cmake gcc clang gdb valgrind build-essential
Execute the script :
sh ubuntu_setup_env.sh
verification
Do the following ssh Command connection verification ( Note that the port configured in the above script is 2222, User name is your own user name )
[email protected]:~$ ssh [email protected] -p2222
The authenticity of host '[localhost]:2222 ([127.0.0.1]:2222)' can't be established. ECDSA key fingerprint is SHA256:hopeXXXXXXXXXXXXXXXXXXXT0CzpIhuPc8zXt1w. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '[localhost]:2222' (ECDSA) to the list of known hosts. [email protected]'s password:
Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 4.4.0-22000-Microsoft x86_64)
In this way, there is no problem to connect .
边栏推荐
- C Programming classic tutorial
- pyhanlp安装教程
- [Tkinter] common components (I)
- Summer Niuke multi school 1:i chiitoitsu (expectation DP, inverse yuan)
- mysql排序.按字段值排序
- FPGA 20个例程篇:9.DDR3内存颗粒初始化写入并通过RS232读取(上)
- 【历史上的今天】7 月 24 日:Caldera 诉微软案;AMD 宣布收购 ATI;谷歌推出 Chromecast
- 多线程与并发编程常见问题(未完待续)
- BUUCTF-pwn[1]
- 暑期牛客多校1: I Chiitoitsu(期望dp,求逆元)
猜你喜欢

轻松学Pytorch-迁移学习实现表面缺陷检查

Crazy God redis notes 11

ETL开发工具Kettle下载安装环境搭建及使用教程

Convolutional Neural Networks in TensorFlow quizs on Coursera

Eternal Blue ms17-010exp reappears

Understand dynamic calculation diagram, requires_ grad、zero_ grad

OpenGL learning (III) glut two-dimensional image rendering

C Programming classic tutorial

Convolution neural network receptive field calculation Guide

Nftscan and port3 have reached strategic cooperation in the field of NFT data
随机推荐
使用 tftp 无法向服务器上传文件问题解决
Nezha monitoring - server status monitoring, SSL certificate change expiration, Ping monitoring and scheduled task reminder
Free and open source website navigation source code collection, sorting and summary - self built personal navigation Homepage
High speed ASIC packaging trends: integration, SKU and 25g+
[Tkinter] common components (II)
Why is gradient the fastest changing direction of function
Introduction to VIM
Redis data type
Sqoop
Sequences, time series and prediction in tessorflow quizs on coursera (II)
About core files
In the spring of domestic databases
MySQL index principle and query optimization "suggestions collection"
Principle and application of database
Zooinspector Download
Cesium uses czml to implement dynamic routes
Cadence OrCAD capture tcl/tk script example
2022 Summer Games of Hangzhou electric power multiple schools 1012aalice and Bob (game theory)
OPENGL学习(五)Modern OpenGL 三角形绘制
今日睡眠质量记录79分