lmmorris1
lmmorris1

Reputation: 31

Changing permissions

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,' trychmod --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

Answers (3)

Pritindra Parida
Pritindra Parida

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

AChampion
AChampion

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

Mox
Mox

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

Related Questions