Jump to content

change permission in UNIX


hisoka

Recommended Posts

I know how to change permission of a file for all users + write :

 

$ chmod a+r example.txt

 

However I do not know how to do it with two files in the same time

 

is it like this :

 

$ chmod a+r example1.txt example2.txt

 

??

 

or how is it exactly ?

 

 

 

 

Link to comment
Share on other sites

I don't think that chmod supports more than one filename. You can use options like -R to change all files in a directory, though. You might also be able to give it a pattern to replace any file that matches the pattern.

Link to comment
Share on other sites

hello justsomeguy how are you doing I hope good :)

 

concerning your reply

 

if for example I have a directory whose name is /home

 

in this directory there are two files : example.txt and example1.txt

 

and I want to change permissions of these two files in the home directory to for all users + write

 

should I do it like this

 

$ chmod a+r /home ? is this command true or wrong ? and if it is wrong what is the right one? :)

Link to comment
Share on other sites

"That will change the permissions on the directory /home itself, not the files inside it"

 

thank you for the valuable information . However I need to change the permission of both files in /home directory regardless their

 

name and extensions for example lets say : I have two files

 

example.txt

 

and

 

intelligent.php

 

in directory /home and I want to change the permission for these both files to all users + write so how can I do it or what is the command to do it ?

Link to comment
Share on other sites

  • 3 weeks later...

That will work: on all files in the home directory, I think.Maybe you should consider naming your files semantically. For example, you may suffix files intended to have read-write permission with '_rw' before the file extension and use wildcard matching to set the permission on all of them at a time.(example:example_rw.txt, example1_rw.html...exampleN_rw.php$ chmod a+r /home/*_rw.*)I don't know if such would work but I hope you get the point. Just try it for yourself.I haven't used UNIX or LINUX before: I'm just a beginner with windows. I've seen so many recommendations for linux systems to programmers. Maybe one day I'll try a linux OS.

Edited by Jonathanks
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...