Zane ha scritto:Quello che vorrei capire io è: da cosa dipende il fatto che su tutte le mie macchine /sbin è nel path e da Matt no?
forse perché uso il su e non sono loggato da root.
evidentemente fa differenza, perché in effetti se mi loggo come root, il comando funziona.
dal forum ufficiale:
Often a user will become root using just 'su', try to run a command (eg, ifconfig), and get a 'command not found' error. For example:
su
Password:
ifconfig
bash: ifconfig: command not found
The reason is that regular system users and the root user have different PATH environment variables (you can view a users PATH with 'echo $PATH'). When you type a Linux command, the shell will search the users PATH to try to locate the command to run. It starts searching each directory on the PATH until a match is found.
Commands for regular users are mostly located in /usr/local/bin, /usr/bin, and /bin. However, root commands are mostly located in /usr/local/sbin, /usr/sbin, and /sbin and root's PATH reflects this.When you become root by using 'su -', you also adopt root's PATH whereas using just 'su' retains the original users PATH, hence why becoming root using just 'su' and trying to run a command located in /usr/local/sbin, /usr/sbin, or /sbin results in a 'command not found' error. For a more detailed explanation, see the bash manual page (man bash), particularly the section on INVOCATION and login shells.
So you either need to specify the full PATH to the command if you just used 'su' (eg, /sbin/ifconfig) or use 'su -' when becoming root.