Your first command
export PATH=/nsm/bro/bin:$PATH is valid in theory, although it's not recommended to prepend to the path - you should append (add to the end) instead.
Have you checked that
/nsm/bro/bin exists and contains the files you want to run?
Also, the command would only affect the current shell session; the PATH will be unaffected in any other shell (so when you open a new terminal the PATH will not include your addition).
bash: /root/.profile: Permission denied
This occurs because you are trying to run a file
/root/.profile which either does not exist or has no execute permission.
If you are root, then the path ~/.profile doesn't lead to your .profile, because
~ expansion is done in reference to the current user. Switch to your normal user and then do
And then add the lines you want, save and exit.
This command seems valid (although not advisable)
root@ubuntu:/home/eng-it/bro-2.2# sudo su -c "echo 'PATH=/opt/bro2/bin:$PATH'>>/etc/profile"
sudo su -c is redundant since you are already root (why are you root? You should avoid this unless absolutely necessary). However, since you installed the program at
/nsm/bro according to your
./configure prefix flag, I don't see why adding
/opt/bro2/bin to the PATH would help.
Even if that path is correct, you need to log out and log back in for changes made in
/etc/profile to take effect. To source them instantly, you can start a login shell by typing
bash -l, or you can source the file you edited
However, it is not recommended to add things to
/etc/profile - you should make a file in
/etc/profile.d, or specify the variable locally for your user in
Assuming the files you want to run are actually in
/nsm/bro/bin, as a normal user (NOT root) You could do
echo 'PATH=$PATH:/nsm/bro/bin' >> ~/.profile
or if you really want to set it globally
sudo bash -c 'echo 'PATH=$PATH:/nsm/bro/bin' > /etc/profile.d/path.sh'
and then log out and log back in.