I have a rails project which I think has been created as root. I want to change the permissions so that the owner is not root but my user.
I found a command here on stackoverflow to achieve this.
sudo chown -R $(username):$(username) Directoryname
So to change it so that my user owns it I am running this:
sudo chown -R $(Jack):$(Jack) APIClient
However I get the error:
sudo: chown: command not found
If i just run chown without sudo I get:
zsh: command not found: chown
Does anyone have any idea how I can fix this? I think it may be to do with my zsh but not sure.
Thanks for any help.
Sudo (superuser do) is a utility for UNIX- and Linux-based systems that provides an efficient way to give specific users permission to use specific system commands at the root (most powerful) level of the system.
-i [command] The -i (simulate initial login) option runs the shell specified by the password database entry of the target user as a login shell. This means that login-specific resource files such as . profile or . login will be read by the shell.
The sudo (superuser do) command is a command-line utility that allows a user to execute commands as the root or a different user. It provides an efficient way to grant certain users the appropriate permissions to use specific system commands or run scripts as the root user.
-h or –help: The -h (help) option causes sudo to print a usage message and exit. 4. -v: If, given the -v (validate) option, sudo will update the user's timestamp, prompting for the user's password if necessary. This extends the sudo timeout for another 5 minutes (or as given in sudoers) but does not run a command.
So @kaman helped me fix the problem in the comments above.
Turns out I didn't have the links to chown in my $PATH variable.
To fix this I added the following to my .zshrc
file. However as kaman has put in the comments above If you're running bash just put it in the .bash_profile
export PATH="$PATH:/usr/sbin"
Thanks kaman and hope this helps anyone else who gets the same error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With