LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 08-24-2009, 02:25 PM   #1
erjohnson227
LQ Newbie
 
Registered: Aug 2009
Location: California
Posts: 3

Rep: Reputation: 0
Linux Read only attribute (undoing this in terminal)


So heres the deal. Please excuse me as i am used to dos based commands and do not know the first thing about unix commands. I have apache running on Ubuntu 9.04 and the default folder is /var/www . now what is the command i can type into terminal to make this folder read/write instead of read only. (NOTE) i cannot change the attributes of this folder through the GUI because although i created this computer it says i dont have root access. So i figured it would be faster to just use the SUDO command.
 
Old 08-24-2009, 03:04 PM   #2
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,038

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
Unix/Linux permissions are not as simple as those in DOS. If my memory serves correctly (though admittedly it's been a long time since) DOS uses a simple scheme with three attributes for each file: read, write and hidden. There's no exec permission, since both DOS and Windows determine if a file is a program based on its extension.

In Linux you have much more than that. The basic ones that should worry about are the read, write and exec permissions, but these are defined in three triplets: read (+r), write (+w) and exec (+x) for the owner of the file; read, write and exec for the group; and read, write and exec for the rest of persons. Also, the exec permission on directories mean "access". So you can't cd to a dir if you don't have the +x permission over it for your user. All this info can be seen with "ls -l" (or -ld for directories), for example, in /var/www you should have something similar to this:

Code:
$ ls -ld /var/www/
drwxr-xr-x 3 apache root 4,0K oct 29  2008 /var/www/
This means that the owner of the file is the user "apache", it's the ID under which the apache server usually runs. The group is "root", the permissions are "rwxr-xr-x", which means "rwx" for the user apache, "r-x" for all the users which belongs to the group "root", and "r-x" for the rest of the users. These are usual permissions for a web.

To set a permission you use chmod. For example, to set write permissions for everyone you would do "chmod a+w /var/www" (I hihgly advise against that). "a" means all, "+w" means to set write permissions. After that, to remove the write permissions again from "group" and "others" you would use these two commands: "chmod g-w /var/www" and "chmod o-w /var/www", where "g" is "group" and "o" is "others", and "-w" is to remove write permissions.

So, first, you need to decide what do you mean when you say that you want to give read and write permissions to /var/www. It really shouldn't be world-writable, this would have many security implications, unless you are only serving it locally in a trusted intranet and can't be reached from the outside. And even then, there's no reason to use a so poor security policy.
 
Old 08-25-2009, 01:32 PM   #3
erjohnson227
LQ Newbie
 
Registered: Aug 2009
Location: California
Posts: 3

Original Poster
Rep: Reputation: 0
thank you very much for the fast reply. that did the trick, the "chmod" command made the files writable so i now have full access to my apache document folder.
 
Old 08-25-2009, 04:33 PM   #4
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,038

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
Again (and feel free to igonre me if you already know this, but it's important), you shouldn't be doing that if the web server is exposed to the public. You are granting *everyone* around the world the permission to write in your web server.
 
Old 08-25-2009, 11:04 PM   #5
erjohnson227
LQ Newbie
 
Registered: Aug 2009
Location: California
Posts: 3

Original Poster
Rep: Reputation: 0
how would i remotely write to my server? ive got it up and running now and was wondering about how to set up FTP so that i can remotely upload files from another authorized computer
 
  


Reply

Tags
attribute, file, read


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sysfs read access on attribute -> output buffer donhuansohn Programming 0 07-14-2009 11:59 AM
What is the system call of getting the terminal attribute? henry0712 Programming 2 01-02-2007 12:06 PM
remove read only attribute in user's directory dsholden Linux - Newbie 5 09-14-2005 05:10 PM
Samba config to allow Windows read-only file attribute changes percheron Linux - Networking 8 09-12-2003 11:56 PM


All times are GMT -5. The time now is 06:54 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration