-
Notifications
You must be signed in to change notification settings - Fork 0
gnu linux network
arvin karimi edited this page Apr 5, 2018
·
1 revision
- for all users /etc/profile
- for current users .bashrc
- for current session run this
export http_proxy=http://USERNAME:PASSOWRD@proxy-server.mycorp.com:3128/
export http_proxy=http://USERNAME:PASSOWRD@proxy-server.mycorp.com:3128/
- add this bash to .bashrc or
create file function.sh and add
source functions.shin .bashrc
#!/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
}
- install semanage
yum install policycoreutils-python
- create rsa on client
ssh-keygen -t rsa - copy public key to remote
- make .ssh directory on remote
ssh user@remote mkdir -p .ssh - copy public key to .ssh dir
cat .ssh/id_rsa.pub | ssh user@remote 'cat >> .ssh/authorized_keys' - set permision to directory and files
ssh user@remote "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"or just do thisssh-copy-id user@remote
- open ssh config file
nano /etc/ssh/sshd_config - uncommnet "#Port 22" and change it
- enable port in firewall
sudo ufw allow {your_port}
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
- restart sshd
sudo systemctl restart sshd - verify
ss -tnlp | grep ssh - Login
ssh user@remote -p {your_port}