Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Support two easy programming solution
New on LowEndTalk? Please Register and read our Community Rules.

Support two easy programming solution

DursDurs Member

Hallo everybody,

I am just an hobby VPS'ler. I am running some rented Servers here. For automatation reason I try to find a solution for me.
Please help me out.

First is I want automate update script the firewall ufw. For this reason I am stuck with the port of wireguard.

I want combine two linux command. I dont know how

command wg show | grep port
output is
listening port: 50 #the port is different in every of my VPS.

hope the get the command
ufw allow 50

Second is extend very common github wireguard script

After first configuration i want create 10 user with one command or one bash script.

I have try
wget https://git.io/wireguard -O wireguard-install.sh && bash wireguard-install.sh -1 -13 -3
but it is not really working.

Please excuse my easy question, but as mechanical engineer. I am not quite skilled in the IT. Google or other Investigation I could not find a solution.

Comments

  • LisoLiso Member
    edited September 22

    Maybe this ? This will tell awk to find line with port in it, then print last field.

    ufw allow $(wg show | awk '/port/{ print $NF }')
    

    This assume port always located in last field, I don't use wireguard so I don't know.

    Thanked by 1Durs
  • i will try thank you

Sign In or Register to comment.