I have a strange issue with the following command:
# chown -R myuser:mygroup *
chown: invalid option -- 'i'
Try 'chown --help' for more information.
the command is not aliases
# type chown
chown is hashed (/bin/chown)
Where I can look further?
I have a strange issue with the following command:
# chown -R myuser:mygroup *
chown: invalid option -- 'i'
Try 'chown --help' for more information.
the command is not aliases
# type chown
chown is hashed (/bin/chown)
Where I can look further?
As the glob (pathname) expansion is done first by the shell before the chown runs, the glob pattern * is expanded to all files in the current directory first and chown is getting those as its options and arguments. You have a file in the current directory that starts with -i, hence chown is considering it as an option, not as an argument (filename).
You need to use -- to indicate the end of options for chown:
chown -R myuser:mygroup -- *
Or precede the glob pattern (*) with ./ to explicitly indicate it as argument:
chown -R myuser:mygroup ./*
The issue was a file named -index.php in the folder, so chown interpreted it as a command line option.
The solution was using the double-hyphens chown -R myuser:mygroup -- *