A
A
Alexey2018-02-11 00:14:55
linux
Alexey, 2018-02-11 00:14:55

How to integrate some bash commands?

As we all know, there are a number of commands on the command line (Bash): ls, nano, node, webpack, etc. , depending on the particular package. The bottom line is that these spells must be stored somewhere, the question is where?
In my case, I ran into a problem related to the environment of root-a and user-a. In the first case, some commands (necessary for the user) are located and executed under root, otherwise for a simple user, the same commands of simple packages (such as webpack) are not found.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Saboteur, 2018-02-11
@saboteur_kiev

These are not spells, but simply executable files.
Bash searches for external commands in the directories listed in the PATH variable ((colon separator)
1. Unlike Windows, bash will not look for a file in the current directory - only in the directories listed in PATH
2. The order matters - the first one found is executed file
3. bash internal commands and alias commands take precedence,
just add the directory with the file you need to your PATH like this:
PATH=$PATH:/new/directory
seems to be different for the root user in the PATH profile than your user.

C
CityCat4, 2018-02-11
@CityCat4

The bottom line is that these spells must be stored somewhere, the question is where?

/bin, /usr/bin, /sbin, /usr/sbin and other directories included in the general search list for executable files, which is stored in the PATH variable
Not all commands make sense for the user to execute - he simply does not have enough rights to execute them. And it does not always make sense to give the user the right to execute these commands.

V
Victor Taran, 2018-02-12
@shambler81

1. We learn the mat part of a colleague which ls
2. The commands necessary for the user can be put / usr / bin
3. Also, do not forget about SUID / SGID, which will allow you to store some of the executable files in the root folder BUT will allow them to be executed without entering a password on his behalf . Example ping is a command that affects interfaces but does not require a root password.
4. If this was not enough, then here's another Jailkit

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question