Reputation: 31
Beginner in Linux/Unix here having an issue with changing the permissions of a file.
I put in the command line:
chmod u+rwx, g+r, o+r file1
But got an error message saying "chmod: invalid mode: u+rwx,' try
chmod --help' for more information.
I don't understand what I am doing wrong.
There was no permissions on the file to begin with either.
Upvotes: 0
Views: 3606
Reputation: 1
Check if you are giving space after ","
chmod u=rwx, g=rx, o=r file_name => It will give invalid mode
chmod u=rwx,g=rx,o=r file_name => It will get executed
Upvotes: 0
Reputation: 30258
You can also use numerical values, where 4=r, 2=w, 1=x (there are others but this answers the OP), you add up the permissions you want and then provide 3 values to chmod for User Group and Other:
chmod 744 file1 (u=rwx,g=r,o=r)
Upvotes: 0
Reputation: 589
Are you using spaces after the commas in your chmod
command? If so, remove them.
chmod u+rwx,g+r,o+r file1
should work.
Upvotes: 5