Table of Contents:

networking

proxy terminal

* add this bash to .bashrc or
create file function.sh and add
`source functions.sh` in .bashrc
```bash
#!/bin/bash

assign_proxy(){
  PROXY_ENV="http_proxy ftp_proxy https_proxy  socks_proxy all_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY SOCKS_PROXY ALL_PROXY"
  for envar in $PROXY_ENV
  do
     export $envar=$1
  done
  for envar in "no_proxy NO_PROXY"
  do
     export $envar=$2
  done
}

clr_proxy(){
  PROXY_ENV="http_proxy ftp_proxy https_proxy  socks_proxy all_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY SOCKS_PROXY ALL_PROXY"
   for envar in $PROXY_ENV
   do
      unset $envar
   done
}

my_proxy(){
#  read -p "ip: " -s  ip && echo -e " "
#  read -p "Port " -s port &&  echo -e " "
#  read -p "method" -s method && echo -e " "
 PROXY='https://127.0.0.1:1080/';
 if [[ ! -z "$1" ]]; then
   PROXY=$1;
 fi

  echo $PROXY;
  proxy_value="$PROXY"
  no_proxy_value="localhost,127.0.0.1,LocalAddress,LocalDomain.com"
  assign_proxy $proxy_value $no_proxy_value
}

firewall

centos

  • install semanage yum install policycoreutils-python

ssh

SSH Login Without Password

  1. create rsa on client ssh-keygen -t rsa
  2. copy public key to remote
  3. make .ssh directory on remote ssh user@remote mkdir -p .ssh
  4. copy public key to .ssh dir cat .ssh/id_rsa.pub | ssh user@remote 'cat >> .ssh/authorized_keys'
  5. set permision to directory and files ssh user@remote "chmod 700 .ssh; chmod 640 .ssh/authorized_keys" or just do this ssh-copy-id user@remote

    change ssh port

  6. open ssh config file
    nano /etc/ssh/sshd_config
  7. uncommnet "#Port 22" and change it
  8. enable port in firewall

    ubuntu

    sudo ufw allow {your_port}

    centos

    sudo semanage port -a -t ssh_port_t -p tcp {your_port}
    sudo firewall-cmd --permanent --zone=public --add-port={your_port}/tcp
    sudo firewall-cmd --reload
    
  9. restart sshd sudo systemctl restart sshd
  10. verify ss -tnlp | grep ssh
  11. Login ssh user@remote -p {your_port}

results matching ""

    No results matching ""