Скрипты для Linux
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.4 KiB

#!/bin/bash
# Copyright 2025 by Alexei Bezborodov <AlexeiBv+linux_script@narod.ru>
# License: Public domain: http://unlicense.org/
# Общественное достояние
[ "${alias_dir}" = "" ] && alias_dir=$(pwd)
source "${alias_dir}/common"
ssh_del_known_host()
{
in_host_pattern=$1
[ "${in_host_pattern}" = "" ] && printf "Укажите шаблон адреса, например '192.168.1.'\n" && return
eval "sudo cp -u ~/.ssh/known_hosts ~/.ssh/known_hosts.backup && cat ~/.ssh/known_hosts.backup | grep -v ${in_host_pattern} > ~/.ssh/known_hosts"
}
mkalias_with_prefix 'ssh_del_known_host'
ssh_for_openwpt_10.3_kamikadze()
{
in_host_pattern=$1
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -c 3des-cbc ${in_host_pattern}
}
mkalias_with_prefix 'ssh_for_openwpt_10.3_kamikadze'
ssh_remote_port_forward()
{
in_host_pattern=$1
[ "${in_host_pattern}" = "" ] && printf "Укажите имя сервера, новый порт и порт на сервере\n"
remote_port=$3
new_port=$2
[ "${remote_port}" = "" ] && remote_port="8384"
[ "${new_port}" = "" ] && new_port="8385"
# Пробрасываем удалённый порт 127.0.0.1:${remote_port} с сервера на текущий компьютер
ssh -L ${new_port}:127.0.0.1:${remote_port} ${in_host_pattern}
#firefox 127.0.0.1:${new_port}
}
mkalias_with_prefix 'ssh_remote_port_forward'