├── LICENSE └── ubuntu_setup_env.sh /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 JetBrains 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ubuntu_setup_env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | SSHD_LISTEN_ADDRESS=127.0.0.1 5 | 6 | SSHD_PORT=2222 7 | SSHD_FILE=/etc/ssh/sshd_config 8 | SUDOERS_FILE=/etc/sudoers 9 | 10 | # 0. update package lists 11 | sudo apt-get update 12 | 13 | # 0.1. reinstall sshd (workaround for initial version of WSL) 14 | sudo apt remove -y --purge openssh-server 15 | sudo apt install -y openssh-server 16 | 17 | # 0.2. install basic dependencies 18 | sudo apt install -y cmake ninja-build gcc clang gdb valgrind build-essential 19 | 20 | # 1.1. configure sshd 21 | sudo cp $SSHD_FILE ${SSHD_FILE}.`date '+%Y-%m-%d_%H-%M-%S'`.back 22 | sudo sed -i '/^Port/ d' $SSHD_FILE 23 | sudo sed -i '/^ListenAddress/ d' $SSHD_FILE 24 | sudo sed -i '/^UsePrivilegeSeparation/ d' $SSHD_FILE 25 | sudo sed -i '/^PasswordAuthentication/ d' $SSHD_FILE 26 | echo "# configured by CLion" | sudo tee -a $SSHD_FILE 27 | echo "ListenAddress ${SSHD_LISTEN_ADDRESS}" | sudo tee -a $SSHD_FILE 28 | echo "Port ${SSHD_PORT}" | sudo tee -a $SSHD_FILE 29 | echo "UsePrivilegeSeparation no" | sudo tee -a $SSHD_FILE 30 | echo "PasswordAuthentication yes" | sudo tee -a $SSHD_FILE 31 | # 1.2. apply new settings 32 | sudo service ssh --full-restart 33 | 34 | # 2. autostart: run sshd 35 | sed -i '/^sudo service ssh --full-restart/ d' ~/.bashrc 36 | echo "%sudo ALL=(ALL) NOPASSWD: /usr/sbin/service ssh --full-restart" | sudo tee -a $SUDOERS_FILE 37 | cat << 'EOF' >> ~/.bashrc 38 | sshd_status=$(service ssh status) 39 | if [[ $sshd_status = *"is not running"* ]]; then 40 | sudo service ssh --full-restart 41 | fi 42 | EOF 43 | 44 | 45 | # summary: SSHD config info 46 | echo 47 | echo "SSH server parameters ($SSHD_FILE):" 48 | echo "ListenAddress ${SSHD_LISTEN_ADDRESS}" 49 | echo "Port ${SSHD_PORT}" 50 | echo "UsePrivilegeSeparation no" 51 | echo "PasswordAuthentication yes" 52 | --------------------------------------------------------------------------------