Alan Lord (News) wrote: > On 17/07/09 06:45, John Matthews wrote: > >> Ok, this is some good news, I have a question to ask, I need to change >> the permissions of a file in one of my folders, on my site, it has to be >> read only, as it is its 777. >> >> I have gotten into the folder and have the list of files and their >> permissions, and I can see the file I need to change, but I am not sure >> of the command. >> >> I know you have to chmod to something but I cannot work it out. >> >> Can somebody help please? >> > > chmod is the right command but, depending on who *owns* the file you > might not have permissions to do so straight away. > > man chmod will help you. There are several ways to achieve the same thing. > > essentially the command is: > > chmod [OPTION]... MODE[,MODE]... FILE... > > or > > chmod [OPTION]... OCTAL-MODE FILE... > > Personally I prefer the octal method. > > Your file has three sets of permissions > > -rw-r--r-- 1 alord alord 49 2009-05-13 19:43 temp > > (BTW, this information is well documented in several of the links we > supplied previously). > > Ignoring the very first (from the left) "-" you should see three groups > of "---" Which in my case show > > rw- (The File Owner: The first alord you see) > r-- (The Group Owner: The 2nd alord) > r-- (Anyone/Everyone: Also referred to as World) > > So, who do you want to have read only access? Everyone but you? Everyone > but you and the group? Or Everyone? > > chmod 444 filename > > Will set all three sets of permissions to Read only. > > chmod 666 filename > > Will set all three sets of perms to Read/Write. > > chmod 555 filename > > Will set all three perms to Read/Execute > > You add up three numbers to get the right one: > > 1: Execute, > 2: Write, > 4: Read. > > If you want the file to be read only for everyone else, but *you* (The > file's owner) needs read/write then do: > > chmod 644 filename > > You do not say what or who owns the file. If it on your webserver, it > might be owned by the web-server perhaps? Sometimes called www-data, > apache, nobody or httpd. The name is [almost] arbitrary but if it isn't > the same as your username you do not own it. > > If you are not the owner you might not be able to change it without > becoming root or assuming root privileges by using sudo (if available on > your system). > > This page (of the link I have referred you to on several occasions) will > explain all this far better than I can in a text-mode email. > > http://linuxcommand.org/lts0070.php > > Alan > > > > > > Hi, thank you so much for your help, I really appreciate it. I am sorry that I have to ask, I am finding it hard to follow some of those instructions,
example in point:- the $pwd commands shows the directory, then it says if you want to change the directory, it tells you to use $cd /usr/then directory you want. I followed those instructions, but nothing was happened, and it wasnt until I thought to go into my Places and do it that way, that I discovered that I have to on my machine, add cd /home/myname/then directory, then it would work. I got down to the permissions page, and it just looked like a lot of stuff, that made no sense at all. I am sorry that I have had to ask, I will try from now on to not bother you. Thank you again, John. -- [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk https://wiki.ubuntu.com/UKTeam/
