0

OS.: Ubuntu 22.04

Scenario

In the Home folder I created a folder called bin. In this folder I clone the GitHub repositories I need.

For example, I cloned this golang repository in my bin folder (the bin folder is in Home).

repository location: /home/focus/bin/dontgo403/

  1. I created a symbolic link called check403 so it can be used from any location:

    cd /usr/local/bin

    sudo ln -s ~/bin/dontgo403/dontgo403 check403

Check that the symbolic link has been created correctly:

readlink check403

/home/focus/bin/dontgo403/dontgo403
  1. I navigated to the Home folder (~) to launch the program from a different location than where it is installed:
    cd ~    
    check403 -u example.com

Output:

2023/01/01 13:38:43 open payloads/httpmethods: no such file or directory (This folder and these files are its dependencies located in the folder where it is installed > `~/bin/dontgo403`).
  1. According to the program description (repository), if I use the -f parameter (to specify the location) everything works as expected:
check403 -f ~/bin/dontgo403/payloads -u example.com

My question is: How can I run the program without always specifying the location of its dependencies, for example: check403 -u example.com (without specifying each time: -f ~/bin/dontgo403/payloads).

In this scenario it is possible with the -f parameter, but I have encountered other scripts/programs that have not declared a location parameter, so they always have to be run from the location where they are installed.

3
  • Hm, what kind of program is that? Dependencies being in the same directory as the executable is not how Linux programs are usually invoked. Jan 1, 2023 at 17:29
  • It is a Pentesting program that checks if blocked resources (403 Forbidden) on your server can be accessed by manipulating the URL address.
    – Marius
    Jan 1, 2023 at 17:34
  • I mean what kind of language does it use? Do you need to compile it? Install it? This sounds like you actually need to install it. Jan 1, 2023 at 17:37

1 Answer 1

0

It's not clear what you are trying to achieve here. You are deploying directly to ~/bin, albeit in a sub-folder implying that this is only intended to be run by a single user, yet you are creating a symlink in /usr/local/bin o expose this to all users, even though they should not have permission to access you ~/bin

Dependencies paths are identified by different means in different languages - relative to the executable / from LD_PATH / from a setting in a configuration file / from a predefined location ....

Rather than creating a symlink to expose the executable, wrap it in a simple shell script in /usr/local/bin or ~/bin :

#!/bin/bash

~/bin/dontgo403/dontgo403 $@

or add an alias.

1
  • Thank you @symcbean!
    – Marius
    Jan 1, 2023 at 20:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .