I'm setting up a new VPS (Ubuntu 20.04), there is something I don't get. As root, I created a custom script in /usr/local/sbin , and I just don't manage to run it even when I use the absolute path.
root@localhost:/usr/local/sbin# sudo /usr/local/sbin/myscript.sh
sudo: /usr/local/sbin/myscript.sh: command not found
sudo bash -c 'echo "$PATH"' returns
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
Thank you very much for your help
ls -l /usr/local/sbin/myscript.sh?sudo bash -x /usr/local/sbin/myscript.sh#!/bin/bash-- make sure whatever is listed actually exists.sudorespondscommand not foundrather than the usualpermission deniedin that case. See for example sudo: ./server: command not found