Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 20th January 2011, 05:14 AM
sepoto Offline
Registered User
 
Join Date: Dec 2010
Posts: 174
linuxfedorafirefox
Permissions

I just installed Fedora (GUI version) on my laptop. I'm using gedit to save a file to /var/www/html and the system keeps telling me that I don't have permissions to save to that directory. Well that's really annoying! It's my system I own all of it! I added myself to the sudoers file I just copy pasted the entry for root and renamed root to joecamel which is my user name. That did not help! What can I do?
Reply With Quote
  #2  
Old 20th January 2011, 09:07 AM
dulotie Offline
Registered User
 
Join Date: Jan 2011
Posts: 11
linuxfirefox
Re: Permissions

Did you try changing the permission to the file?
Reply With Quote
  #3  
Old 20th January 2011, 09:09 AM
sepoto Offline
Registered User
 
Join Date: Dec 2010
Posts: 174
linuxfedorafirefox
Re: Permissions

I ended up doing this:

chmod -r 777 var/

or was it?

chmod 777 -r var/

I can't remember. All I really wanted to do was to give user joecamel rwe access to var/ but I havn't figured out how to do that yet.
Reply With Quote
  #4  
Old 20th January 2011, 11:32 AM
jroa1 Offline
Registered User
 
Join Date: Oct 2010
Posts: 229
linuxfedorafirefox
Re: Permissions

You have to be careful changing permissions like that. I know most Windows users come to Linux thinking that they should have the right to do what ever they want to their computer, and do so with out being prompted for a password. This is one of the reasons that Linux is more secure than Windows and also the reason that they disabled the root login option in Fedora.

What you did with chmod is change all of the permissions for every file in the var directory. Now, anyone on your computer can read, write, and execute every file in that directory. If you want full access to your computer, then chmod -r 777 / will do that for you. But good luck with that and be prepared to post a new discussion in the future asking why your computer is all screwed up.
Reply With Quote
  #5  
Old 20th January 2011, 07:05 PM
sepoto Offline
Registered User
 
Join Date: Dec 2010
Posts: 174
linuxfedorafirefox
Re: Permissions

Thanks. I was actually hoping someone would post an example of chmod showing me how to grant only the users joecamel and root rwe access to var/ and everyone else nothing. It's not that easy to figure out. I could be reading man pages for days if someone doesn't tell me how to do it.
Reply With Quote
  #6  
Old 20th January 2011, 07:24 PM
JEO Offline
Registered User
 
Join Date: Jan 2006
Posts: 2,769
linuxfedorafirefox
Re: Permissions

You can use chown to take ownership of the files, for example:

su -
chown -R joecamel /var/www

then you can reset the permissions to the default using chmod. By default the owner has r/w access.
Reply With Quote
  #7  
Old 20th January 2011, 08:47 PM
SlowJet Offline
Registered User
 
Join Date: Jan 2005
Posts: 5,002
windows_xp_2003ie
Re: Permissions

This is not the best way to do this type of file maintainence.
One needs to be aware of the role (or Job) they are performming and then put on the correct HAT(i.e. correct username, correct commands, correct methods)

/home/me/Documents/mywebappfiles

su -
<rootpassword>
cd /var/www/html
mkdir mywebappfiles
cd /home/me/Documents/mywebappfiles
cp -t /var/www/html/mywebappfiles *
cd /var/www/html/mywebappfiles
chown -R apache:apache /mywebappfiles
chmod -R 500 /mywebappfiles
chmod 700 mywebfilethatiswrttento.html

... etc

Now the web app files can only be used by apache user and group in the httpd server (and root of course.)

It's 99% planning and 4.5% methods and .5% commands.

SJ

p. S. read up on selinux setting for cp and mv.
__________________
Do the Math
Reply With Quote
  #8  
Old 20th January 2011, 09:23 PM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,110
linuxfedorafirefox
Re: Permissions

You did leave out all the labels that have to be set...

For those readonly files and directories:

chcon -R -t httpd_sys_content_t mywebappfiles

For those directories that apache will be writing to:

chcon -R -t httpd_sys_rw_content_t <directory>

And you have to tell SELinux to maintain those labels if the system ever
goes through a relabel:

semanage fcontext -a -t httpd_sys_content_t <mywebappfiles>
semanage fcontext -a -t httpd_sys_rw_content_t <directoryorfiles>

If you are going to put them in your home directory it is just simpler
to enable home directory support.
Reply With Quote
  #9  
Old 21st January 2011, 11:40 PM
SlowJet Offline
Registered User
 
Join Date: Jan 2005
Posts: 5,002
windows_xp_2003ie
Re: Permissions

Yes, there may be selinux labeling needed but
chown -R apache:apache mywebappfiles
does this autmagically, I think, in /var/www/html/.
chcon -R -t httpd_sys_content_t mywebappfiles

"If you are going to put them in your home directory it is just simpler
to enable home directory support.

Yes, KISS, but KISS and Secure.
Multiple users means multiple paths from otuside.

And of course, the environment, is it development, testing, user acceptance, or production.

SJ
__________________
Do the Math
Reply With Quote
  #10  
Old 22nd January 2011, 01:48 AM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,110
linuxfedorafirefox
Re: Permissions

You already have multiple paths from outside by changing the ownership
of the files and protection masks in the first place
Reply With Quote
Reply

Tags
permissions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HFS+ Permissions moondog417 Hardware & Laptops 0 7th July 2009 04:48 AM
USB permissions phosphide Using Fedora 0 18th June 2009 12:54 AM
Permissions Neshberatu Using Fedora 4 6th September 2008 02:52 AM
httpd permissions, hda1 User permissions, Cake? Fault Using Fedora 7 1st August 2006 07:12 PM
permissions Icablob Using Fedora 8 3rd May 2005 04:08 PM


Current GMT-time: 20:30 (Saturday, 25-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat