# [Record] System and development environment setup on Raspberry Pi 2 Model B
###### tags: `env setup`, `ssh`, `telnet`, `samba`, `vsftp`, `fail2ban`, `ctags`, `cscope`, `tmux`, `tig`, `vim-plug`, `zsh`, `linux source insight`, `rpi`, `git server`, `proxy settings`
[toc]
# Preface
In this note, I record some procedures and demo how to setup and configure utility like tig, tmux, ctags or network services like ssh, telnet, FTP and SAMBA on a host or a server. I just use RPi2 as an example here.
# System Information
## Hardware
- Raspberry pi 2 model B

- Transcend 16GB MicroSD card

## Software
- Linux raspberrypi 5.4.79-v7
- NOOBS by ["How to install NOOBS?"](https://www.raspberrypi.org/help/noobs-setup./)
# Installed Packages
## Service
```shell
Tomas# apt-get install net-tools tcpd ssh samba xinetd telnetd vsftpd
```
## Utility
```shell
Tomas# sudo add-apt-repository ppa:x4121/ripgrep
Tomas# sudo apt-get update
Tomas# sudo apt-get install vim git tig zsh cscope ctags wget curl silversearcher-ag vim-scripts ripgrep tree members docker.io fail2ban tftpd-hpa tftp-hpa minicom
Tomas# sudo vim-addons install taglist
# for oh-my-zsh
Tomas# sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# or
Tomas# sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# for vim-plug
Tomas# sudo curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
```
# Basic System Configuration
## Create users and groups
```shell
# Tomas is the originalest admin user in the system.
#
# 1. Create a group
Tomas# sudo groupadd Superhero
Tomas# sudo mkdir /home/earth
Tomas# sudo chown Tomas:Superhero /home/earth
# 2. Create users
sudo useradd -m IronMan -G Superhero -s /bin/bash -d /home/earth/ironman
sudo useradd -m Hulk -G Superhero -s /bin/bash -d /home/earth/hulk
# 3. Let them as sudoers and be in the group of dialout to access tty devices
sudo usermod -aG sudo IronMan
sudo usermod -aG sudo Hulk
sudo usermod -aG dialout IronMan
sudo usermod -aG dialout Hulk
# 4. Set passwords
echo "IronMan:IronManPwd" | sudo chpasswd
echo "Hulk:HulkPwd" | sudo chpasswd
```
## ZSH Setting
```shell
Tomas# sudo chsh --shell "/usr/bin/zsh"
# or
Tomas# sudo vi /etc/password
# Find the row with Tomas and modify it like below line
Tomas:x:1002:1002::/home/earth/tomas:/usr/bin/zsh
Tomas# sudo vi ~/.zshrc
# Change the default theme
ZSH_THEME="obraun"
# Test it locally or reboot
ssh username@localhost
```
### Add alias in oh-my-zsh
```shell
Tomas# cat > ~/.oh-my-zsh/custom/alias.zsh << EOF
alias sysd='sudo -b unshare --pid --fork --mount-proc /lib/systemd/systemd --system-unit=basic.target;sudo -E nsenter --all -t $(pgrep -xo systemd) runuser -P -l $USER -c "exec $SHELL"'
# connect to minicom 0 ttyUSB0
alias com0="sudo minicom -t linux -D /dev/ttyUSB0"
# connect to minicom n with ttyUSBn where n=0 to 5
alias com0="minicom -t linux -D /dev/ttyUSB0"
alias com1="minicom -t linux -D /dev/ttyUSB1"
alias com2="minicom -t linux -D /dev/ttyUSB2"
alias com3="minicom -t linux -D /dev/ttyUSB3"
alias com4="minicom -t linux -D /dev/ttyUSB4"
alias com5="minicom -t linux -D /dev/ttyUSB5"
# disconnect to minicom n from ttyUSBn where n=0 to 5
alias kom0="sudo fuser -k /dev/ttyUSB0"
alias kom1="sudo fuser -k /dev/ttyUSB1"
alias kom2="sudo fuser -k /dev/ttyUSB2"
alias kom3="sudo fuser -k /dev/ttyUSB3"
alias kom4="sudo fuser -k /dev/ttyUSB4"
alias kom5="sudo fuser -k /dev/ttyUSB5"
nb='resize -s 54 154'
EOF
Tomas# source ~/.oh-my-zsh/oh-my-zsh.sh
```
## minicom
```shell
sudo minicom -t linux -D /dev/ttyUSB0
```
## Vim Plugins Install and Config
### 1. vim-fugitive
### 2. rainbow
### 3. lightline.vim
### 4. nerdtree
### 5. nerdcommenter
### 6. vim-solarized8
### 7. fzf
### 8. SrcExpl
### 9. Trinity
### 10. ctags
### 11. cscope
```shell
# Install vim-plug
Tomas# sudo curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
Tomas# vi ~/.vimrc
# Add the function
call plug#begin('~/.vim/plugged')
# Add the plugins you want to install
Plug 'tpope/vim-fugitive'
Plug 'luochen1990/rainbow'
Plug 'itchyny/lightline.vim'
Plug 'preservim/nerdtree'
Plug 'preservim/nerdcommenter'
Plug 'lifepillar/vim-solarized8'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'https://github.com/wesleyche/SrcExpl.git'
Plug 'https://github.com/wesleyche/Trinity.git'
call plug#end()
:source %
:PluginInstall
# Settings for all the plugins by adding below lines
" Plug 'junegunn/vim-easy-align'
" Plug 'https://github.com/junegunn/vim-github-dashboard.git'
"
"" Multiple Plug commands can be written in a single line using | separators
"Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
"
"" On-demand loading
"Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
"
"" Using a non-default branch
"Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
"
"" Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
"Plug 'fatih/vim-go', { 'tag': '*' }
"
"" Plugin options
"Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
"
"" Unmanaged plugin (manually installed and updated)
"Plug '~/my-prototype-plugin'
"
" Initialize plugin system
call plug#end()
" for rainbow
let g:rainbow_active = 1
" for lightline.vim'
set laststatus=2
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'readonly', 'absolutepath', 'modified' ] ]
\ },
\ }
" for nerdtree
"autocmd VimEnter * NERDTree | wincmd p
"nnoremap <F9> :NERDTreeToggle<CR>
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() |
\ quit | endif
" for nerdcommenter
let g:NERDSpaceDelims = 1
let g:NERDTrimTrailingWhitespace = 1
" for vim-solarized8
syntax enable
let g:solarized_termcolors=256
set background=dark
colorscheme solarized8
" for fzf
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
" Default fzf layout
" - down / up / left / right
let g:fzf_layout = { 'down': '~40%' }
" Customize fzf colors to match your color scheme
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
" Enable per-command history.
" CTRL-N and CTRL-P will be automatically bound to next-history and
" previous-history instead of down and up. If you don't like the change,
" explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS.
let g:fzf_history_dir = '~/.local/share/fzf-history'
nnoremap <space>fl :Lines
nnoremap <space>fb :BLines
nnoremap <space>ff :Files
nnoremap <space>fg :GFiles
nnoremap <space>f? :GFiles?
nnoremap <space>ft :Tags<cr>
nnoremap <space>fa :Ag
nnoremap <space>fc :Commits
" for taglist
"nmap <F8> :TlistToggle<CR><CR>
set nocompatible
syntax on
set number
set cursorline
set ruler
set shiftwidth=4
set softtabstop=4
set tabstop=4
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
set ut=100
" for SrcExpl
"nmap <F7> :SrcExplToggle<CR>
" // Set the height of Source Explorer window
let g:SrcExpl_winHeight = 8
" // Set 100 ms for refreshing the Source Explorer
let g:SrcExpl_refreshTime = 100
" // Set "Enter" key to jump into the exact definition context
let g:SrcExpl_jumpKey = "<ENTER>"
" // Set "Space" key for back from the definition context
let g:SrcExpl_gobackKey = "<SPACE>"
" // In order to avoid conflicts, the Source Explorer should know what plugins except
" // itself are using buffers. And you need add their buffer names into below list
" // according to the command ":buffers!"
let g:SrcExpl_pluginList = [
\ "__Tag_List__",
\ "_NERD_tree_",
\ "Source_Explorer"
\ ]
" // The color schemes used by Source Explorer. There are five color schemes
" // supported for now - Red, Cyan, Green, Yellow and Magenta. Source Explorer
" // will pick up one of them randomly when initialization.
let g:SrcExpl_colorSchemeList = [
\ "Red",
\ "Cyan",
\ "Green",
\ "Yellow",
\ "Magenta"
\ ]
" // Enable/Disable the local definition searching, and note that this is not
" // guaranteed to work, the Source Explorer doesn't check the syntax for now.
" // It only searches for a match with the keyword according to command 'gd'
let g:SrcExpl_searchLocalDef = 1
" // Workaround for Vim bug @https://goo.gl/TLPK4K as any plugins using autocmd for
" // BufReadPre might have conflicts with Source Explorer. e.g. YCM, Syntastic etc.
" // Do not let the Source Explorer update the tags file when opening
let g:SrcExpl_isUpdateTags = 0
" // Use 'Exuberant Ctags' with '--sort=foldcase -R .' or '-L cscope.files' to
" // create/update the tags file
let g:SrcExpl_updateTagsCmd = "ctags --sort=foldcase -R ."
" // Set "<F12>" key for updating the tags file artificially
let g:SrcExpl_updateTagsKey = "<F12>"
" // Set "<F3>" key for displaying the previous definition in the jump list
let g:SrcExpl_prevDefKey = "<F3>"
" // Set "<F4>" key for displaying the next definition in the jump list
let g:SrcExpl_nextDefKey = "<F4>"
" for trinity
" Open and close all the three plugins on the same time
nmap <F8> :TrinityToggleAll<CR>
" Open and close the Source Explorer separately
nmap <F9> :TrinityToggleSourceExplorer<CR>
" Open and close the Taglist separately
nmap <F10> :TrinityToggleTagList<CR>
" Open and close the NERD Tree separately
nmap <F11> :TrinityToggleNERDTree<CR>
nmap zs :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap zg :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap zc :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap zt :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap ze :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap zf :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap zi :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap zd :cs find d <C-R>=expand("<cword>")<CR><CR>
Tomas#
```
# Service Configuration
## Proxy settings
### Git
```shell
Tomas# cat >> ~/.gitconfig << EOF
[http]
proxy = http://x.x.x.x:xxxx/
[https]
proxy = https://x.x.x.x:xxxx/
EOF
```
### Apt
```shell
Tomas# sudo cat >> /etc/apt/apt.conf.d/proxy.conf << EOF
Acquire::http::Proxy "http://user:password@proxy.server:port/";
Acquire::https::Proxy "http://user:password@proxy.server:port/";
EOF
# Example
Tomas# sudo cat >> sudo /etc/apt/apt.conf.d/proxy.conf << EOF
Acquire::http::Proxy "http://x.x.x.x:xxxx/";
Acquire::https::Proxy "http://x.x.x.x:xxxx/";
EOF
```
### docker
```shell
Tomas# mkdir -p ~/.docker
Tomas# cat >> ~/.docker/config.json << EOF
{
"proxies":
{
"default":
{
"httpProxy": "http://x.x.x.x:x",
"httpsProxy": "https://x.x.x.x:x",
"noProxy": "*.test.example.com,.example2.com,127.0.0.0/8"
}
}
}
EOF
```
### shell
```shell
Tomas# cat >> ~/.zshrc << EOF
export httpProxy="http://x.x.x.x:xxxx"
export httpsProxy=https://x.x.x.x:xxxx"
EOF
Tomas# source ~/.zshrc
```
### tftp server (tftpd-hpa)
#### Configuration
```shell
vim /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/home/tftp"
TFTP_ADDRESS=":69"
TFTP_OPTIONS="-l -c -s"
sudo mkdir /home/tftp
sudo chmod 777 -R /tftpboot
sudo chown nobody.nogroup -R /tftpboot
service tftpd-hpa restart
netstat -a | grep tftp
```
#### Usage
```shell
# Assume:
# - server ip: 192.168.2.100
# - client ip: 192.168.2.1 with tftpd version 5.2
# on client side:
Usage tftp [-4][-6][-v][-l][-m mode] [host[port]] [-c command]
tftp 192.168.2.100 -cv get file_from_server
tftp 192.168.2.100 -cv put file_in_client
# on server side
sudo systemctl status tftpd-hpa.service
```
## SSH Setting
```shell
Tomas# sudo vi /etc/ssh/sshd_config
# Unmark below line
#Port 22
#PasswordAuthentication yes
Tomas# sudo service ssh restart
#or
Tomas# sudo /etc/init.d/ssh restart
```
### SSH Proxyjump
#### Config
```shell
Tomas# vi ~/.ssh/config
# The stepping stone
Host jump
Hostname 172.16.x.x
User tom
IdentityFile ~/.ssh/id_rsa_tom
# The target
Host target
HostName 192.168.x.x
User root
IdentityFile ~/.ssh/id_rsa_target
ProxyJump jump
```
#### Usage
```shell
Tomas# scp images/xxx.bin dut:/mnt/flash/
Tomas# ssh dut
```
### Troubleshooting
#### Sympton
```shell
Tomas# ssh tomas@local
The authenticity of host '<host>' can't be established.
ECDSA key fingerprint is SHA256:TER0dEslggzS/BROmiE/s70WqcYy6bk52fs+MLTIptM.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'pc' (ECDSA) to the list of known hosts.
```
#### Solution
```shell
Tomas# cat >> ~/.ssh/config << EOF
# Don't listen yes/no.
StrictHostKeyChecking no
# Ignore "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!"
UserKnownHostsFile=/dev/null
EOF
```
## Telnet Setting
```shell
Tomas# sudo vi /etc/inetd.conf
# Add below line
telnet stream tcp nowait telnetd /usr/sbin/tcpd /usr/sbin/in.telnetd
Tomas# sudo vi /etc/xinetd.d/telnet
# Add below lines
service telnet
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
}
# Restart service
sudo service xinetd restart
```
## Samba Setting
```shell
Tomas# sudo vi /etc/samba/smb.conf
# Add below lines:
[homes]
comment = Home Directories
browseable = yes
read only = no
create mask = 0644
directory mask = 0755
valid users = %S
[earths]
comment = Public Directories
path = /home/earth
browseable = yes
read only = no
writable = yes
create mask = 0644
directory mask = 0755
valid users = @Superhero
# Set passwords
echo -e "IronManPwd\nIronManPwd\n" | sudo smbpasswd -a -s IronMan
echo -e "HulkPwd\nHulkPwd\n" | sudo smbpasswd -a -s Hulk
# Restart service
sudo /etc/init.d/samba-ad-dc restart
sudo service smbd restart
```
## SFTP group/user Setting
1. Create the group and account
```shell
Tomas# sudo echo "/usr/sbin/nologin" >> /etc/shells
Tomas# sudo groupadd SFTP
Tomas# sudo useradd -m AntMan -G SFTP -s /usr/sbin/nologin -d /home/sftp/antman
Tomas# echo "AntMan:AntManPWD" | sudo chpasswd
```
2. Create a public folder for all users
```shell
Tomas# mkdir -p /home/sftp/public
Tomas# sudo mkdir -p /home/sftp/antman/public
Tomas# sudo chown AntMan:SFTP /home/sftp/antman/public
Tomas# sudo mount --bind /home/sftp/public /home/sftp/antman/public
Tomas# sudo vi /etc/fstab
# Add below line
/home/sftp/public /home/sftp/antman/public none defaults,bind 0 0
```
## Vsftpd Setting
```shell
Tomas# sudo vi /etc/ssh/sshd_config
Port 22
ClientAliveInterval 120
ClientAliveCountMax 5
Subsystem sftp internal-sftp
Match group sftp
ChrootDirectory /home/sftp/%u
ForceCommand internal-sftp
X11Forwarding no
AllowTcpForwarding no
# Start the service
Tomas# systemctl start sshd
Tomas# sudo vi /etc/vsftpd.conf
# Add/Modify below lines
listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
pasv_enable=Yes
pasv_min_port=10000
pasv_max_port=10100
allow_writeable_chroot=YES
ssl_enable=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
require_ssl_reuse=NO
ssl_ciphers=HIGH
debug_ssl=YES
connect_timeout=300
accept_timeout=300
# Start the service
Tomas# systemctl start vsftpd
Tomas# systemctl enable vsftpd
# Set ufw
Tomas# sudo ufw allow 22
Tomas# sudo ufw allow 445/tcp
Tomas# sudo ufw allow from any to any proto tcp port 10000:10100
Tomas# sudo systemctl start ufw
Tomas# sudo systemctl enable ufw
Tomas# sudo ufw enable
Tomas# sudo ufw status numbered
```
https://www.linuxquestions.org/questions/linux-newbie-8/create-a-public-directory-for-chroot-ftp-users-4175461164/
https://www.796t.com/article.php?id=134165
## Fail2ban Setting
Utilize fail2ban to prevent ssh service from brute-force attack. An IP will be banned forever if it fails over 10 times authentication.
```shell
Tomas# sudo vi /etc/fail2ban/jail.local
[sshd]
ignoreip = 192.168.10.1/24
enabled = true
port = 22
filter = sshd
logpath = /var/log/auth.log
maxretry = 10
bantime = -1
Tomas# sudo systemctl enable fail2ban
Tomas# sudo systemctl start fail2ban
Tomas# sudo fail2ban-client status
```
# Annex
## Vim Setting
{%gist 5e4cbac702e347bd455e9bf1b981fc9e %}
```shell
# Modify below script
Tomas# vi ~/.vimrc
```
## Tmux Setting
{%gist 1ce273fb8e1ed8e27e124eb288e94dd9 %}
```shell
# Modify below script
Tomas# vi ~/.tmux.conf
Tomas# tmux source-file ~/.tmux.conf
```
## Tmux Session Save and Restore Setting
It is more convenient to use the TPM plugin **"[tmux-resurrect](https://github.com/tmux-plugins/tmux-resurrect)"**.
- prefix + ctrl + s to save tmux env setting.
- prefix + ctrl + r to restore saved tmux env setting.
{%gist a69fb3ca236108fbb58bedfa51bb6f14 %}
``` shell
# 1. Create below script
Tomas# vi tmux-ssesion
# 2. Schedule it by crontab
Tomas# crontab -u tomas -e
*/30 * * * * /home/earth/tomas/tmux-session save
@reboot /home/earth/tomas/tmux-session restore
```
## Cscope Setting
{%gist 558f12443653b10a0f8fdb3869e00e2f %}
```shell
# 1. Create below script
Tomas# vi cscope.sh
# 2. Change mod
Tomas# sudo chmod +x cscope.sh
# 3. Copy this script to your source code or project directory
Tomas# cp cscope.sh project/
```
## git setting
### git server
```shell
Tomas# sudo adduser git
Tomas# su git
git# cd ~
git# mkdir .ssh && chmod 700 .ssh
git# touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
git# mkdir -p git_repo/project.git
git# cd git_repo/project.git
git# git init --bare
```
## git client
```shell
Tomas# git config --global core.editor vim
Tomas# git config --global user.name <username>
Tomas# git config --global user.email <mailaddress>
Tomas# git clone git@192.168.1.100:~/git_repo/project.git
Cloning into 'project'...
Tomas# @localhost's password:
warning: You appear to have cloned an empty repository.
```
### Add authorized keys to git server for clients
The purpose is to skip entering password when doing git clone.
```shell
Tomas# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/tomas/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/tomas/.ssh/id_rsa
Your public key has been saved in /home/tomas/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:MGU98NrDN0Zl3nQjBZM9q4lBVc3ZbQexT3yKUYq96i4 tomas@T1-1-1-Q-60886
The key's randomart image is:
+---[RSA 3072]----+
| o++==o |
| o += o |
| . .... o|
| .o +. . |
| So++..E |
| ...=*. . |
| . + oo**. |
| + +o%o.o |
| . ..+.*+ |
+----[SHA256]-----+
Tomas# cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDdMviseiTNXphZKXlccQcF7aFK9CFY1yTD9J2z/ByHpC2O3KaxAjwEPTNNUSQSdNBListG/5wv6wNAvwt9ZQw1kcUoc1aFPFks8vksW9JzpLziJ86BT6wPcsJeACn8RXRAOs9L4Gs6rv6d/jJt9s/1ekfmMniJr+fyiZbCoM0yaaikn0yqQWcUUEHS38Bv7CYEi24fBi39wSbGQNEHQBlX4xRby0Zmb4qCjJ1WKAXvy1Y8ZC87S0vi1a/izLqKqxoLtP7gnilexgd9t30RhpipM5UA4g6u4+tV9n4X+2/edAofCwYUC0J5ksAO4VgWBFByPhFdZlJmQ2au549FOE112q5yCt9wZkKkwlHYvKZUFzBW84/ofbQBJRg7W4fHIxEbgKglopUzA1iD6Zf3DQNtCRA8ER8TT+NSAJClWloCes+sNXvWs4lO60/T5Mw//gnDiUxHKB4tIy9wD7NzoFuyycOKmclcHSsTXc2MdKsDS87Zz1fclqXQcCzEcSLqmZ0= Tomas@build-server
Tomas# su git
git# cat >> ~/.ssh/authorized_keys << EOF
> AAAAB3NzaC1yc2EAAAADAQABAAABgQDdMviseiTNXphZKXlccQcF7aFK9CFY1yTD9J2z/ByHpC2O3KaxAjwEPTNNUSQSdNBListG/5wv6wNAvwt9ZQw1kcUoc1aFPFks8vksW9JzpLziJ86BT6wPcsJeACn8RXRAOs9L4Gs6rv6d/jJt9s/1ekfmMniJr+fyiZbCoM0yaaikn0yqQWcUUEHS38Bv7CYEi24fBi39wSbGQNEHQBlX4xRby0Zmb4qCjJ1WKAXvy1Y8ZC87S0vi1a/izLqKqxoLtP7gnilexgd9t30RhpipM5UA4g6u4+tV9n4X+2/edAofCwYUC0J5ksAO4VgWBFByPhFdZlJmQ2au549FOE112q5yCt9wZkKkwlHYvKZUFzBW84/ofbQBJRg7W4fHIxEbgKglopUzA1iD6Zf3DQNtCRA8ER8TT+NSAJClWloCes+sNXvWs4lO60/T5Mw//gnDiUxHKB4tIy9wD7NzoFuyycOKmclcHSsTXc2MdKsDS87Zz1fclqXQcCzEcSLqmZ0= Tomas@build-server
> EOF
```
## Lazyvim
### Install
https://www.lazyvim.org/installation
### Troubleshooting
**nvim-treesitter Error during download, please verify your internet connection**
https://github.com/nvim-treesitter/nvim-treesitter/issues/3232
### Usage
https://github.com/bryant-video/neovim-tutorial/tree/main
https://www.youtube.com/watch?v=c5icE_ZxMzQ
https://www.youtube.com/watch?v=Wh2Uh3g5fOM
https://www.lazyvim.org/
https://github.com/folke/lazy.nvim?tab=readme-ov-file
## Nerd fonts
### Install on ubuntu
```bash
#!/bin/bash
declare -a fonts=(
BitstreamVeraSansMono
CodeNewRoman
DroidSansMono
FiraCode
FiraMono
Go-Mono
Hack
Hermit
JetBrainsMono
Meslo
Noto
Overpass
ProggyClean
RobotoMono
SourceCodePro
SpaceMono
Ubuntu
UbuntuMono
)
version='2.1.0'
fonts_dir="${HOME}/.local/share/fonts"
if [[ ! -d "$fonts_dir" ]]; then
mkdir -p "$fonts_dir"
fi
for font in "${fonts[@]}"; do
zip_file="${font}.zip"
download_url="https://github.com/ryanoasis/nerd-fonts/releases/download/v${version}/${zip_file}"
echo "Downloading $download_url"
wget "$download_url"
unzip "$zip_file" -d "$fonts_dir"
rm "$zip_file"
done
find "$fonts_dir" -name '*Windows Compatible*' -delete
fc-cache -fv
```
https://gist.github.com/matthewjberger/7dd7e079f282f8138a9dc3b045ebefa0
## Remote access of Raspberry Pi desktop
Connect from Windows Remote Desktop Client.
```shell
sudo apt update
sudo apt upgrade
sudo apt install xrdp
sudo systemctl status xrdp
sudo systemctl start xrdp
```
https://www.youtube.com/watch?v=T8ZOZZKsb_c
## Windterm
### Modify fonts
1. Open windterm-install-path/global/themes/dige-black/scheme.theme
2. Add your font name in fontFamily of "text.default" session as shown below
```json
{
"name": "text.default",
"style": {
"foreground": "#F8F8F2",
"background": "#1c1c1c",
"fontFamily": "Roboto Mono, Fira Code Retina, Lucida Sans Typewriter, Lucida Console, Monoca, 3270NerdFontMono",
"fontSize": 10
}
}
```
https://github.com/kingToolbox/WindTerm/issues/148
### Install on Windows
1. Download the fonts you want
https://www.nerdfonts.com/font-downloads
2. Unzip it
3. Select all the fonts and install
# Reference
https://www.tecmint.com/install-ftp-server-in-ubuntu/
https://www.tecmint.com/secure-ftp-server-using-ssl-tls-on-ubuntu/
http://nickinwork.blogspot.com/2013/10/ubuntu-telnet-server-ssh-server.html
https://phoenixnap.com/kb/how-to-add-user-to-group-linux
https://sites.google.com/site/linuxcooltea/home/ubuntu-she-dingssh-yuan-duan-lian-xian-gong-neng
https://github.com/ohmyzsh/ohmyzsh/tree/6fbad5bf72fad4ecf30ba4d4ffee62bac582f0ed
https://blog.gtwang.org/linux/linux-crontab-cron-job-tutorial-and-examples/
https://superuser.com/questions/440015/restore-tmux-session-after-reboot
https://www.cyberciti.biz/faq/how-to-delete-a-ufw-firewall-rule-on-ubuntu-debian-linux/
https://www.linuxquestions.org/questions/linux-newbie-8/create-a-public-directory-for-chroot-ftp-users-4175461164/
https://stackoverflow.com/questions/3663895/ssh-the-authenticity-of-host-hostname-cant-be-established
https://cmdref.net/os/linux/user/ssh.html
https://medium.com/@nutanbhogendrasharma/setup-git-repository-in-ubuntu-20-04-vps-864f784ecab1
https://www.serverlab.ca/tutorials/linux/administration-linux/how-to-set-the-proxy-for-apt-for-ubuntu-18-04/
https://docs.docker.com/network/proxy
https://medium.com/starbugs/tpm-%E5%A5%97%E4%BB%B6%E7%AE%A1%E7%90%86%E5%B7%A5%E5%85%B7-%E8%AE%93%E4%BD%A0%E7%9A%84-tmux-%E6%9B%B4%E5%A5%BD%E7%94%A8-95ecd924c9d
https://github.com/tmux-plugins/tmux-resurrect