Results 1 to 10 of 14
I am using CentOS 6.X.
I am trying to give a user called "blog" access to read, write and execute files and folders in his directory.
His directory is at ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 12-08-2012 #1Just Joined!
- Join Date
- Nov 2012
- Posts
- 10
Read, write, execute permissions not working.
I am using CentOS 6.X.
I am trying to give a user called "blog" access to read, write and execute files and folders in his directory.
His directory is at /home/web/html/blog/
How can I give him his proper access?
I've tried chmod -R /home/web/html/blog/ 775
Note : His group is set to "apache" for some reason, the same as the account for my web hosting software. I'm not sure why.
- 12-08-2012 #2Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,683
Hello,
The usage of chmod is:
so try:Code:chmod [OPTION]... MODE[,MODE]... FILE...
but if this is blog's home dir, why cannot he do this himself?Code:chmod -R 775 /home/web/html/blog/
Can you not change it to his group, using chown?
Originally Posted by xavieranderson
get his primary group name like:
say his group name is "users". then use chown like:Code:groups blog|awk '{print $3}'
Code:chown blog:users /home/web/whatever
- 12-08-2012 #3Linux Newbie
- Join Date
- Dec 2011
- Posts
- 119
do
chgrp apache /home/web/html/blog/
or, more likely
chown blog /home/web/html/blog/
or both, now that you've set the perms appropriately.
- 12-08-2012 #4Just Joined!
- Join Date
- Nov 2012
- Posts
- 10
Ok, for the sake of simplicity, I changed "blog"'s group to "blog".
After I did that, the home directory no longer applies, it sets the home dir to /. Even after I applied the home directory to "/home/web/html/blog/"
Now if I do
chgrp blog /home/web/html/blog/
It still doesn't work. Not only that, but now all other directories besides /home/web/html/blog are now completely read write and executable....
This doesn't really make sense, as this is the exact opposite of what we need. Is something wrong with my system files?
- 12-08-2012 #5Linux Guru
- Join Date
- Oct 2007
- Location
- Tucson AZ
- Posts
- 2,515
His directory is at /home/web/html/blog/The directory would appear to be for a web server and on many Linux system you need user:group apache:apache so put your user "blog" in the apache group. See the link below which describes the method for Ubuntu. For CentOS, replace www-data with apache.His group is set to "apache" for some reason
Ubuntu Linux: Add a User To Group www-data ( Apache Group )
If this isn't a web server (??) post back.
- 12-09-2012 #6Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,683
What does "applying the home directory" mean, exactly? That does not make sense to me. Can you show a command that illustrates what you mean, and show errors it gives, if it fails?
Also, if this a web server, and you are trying to access the files via a browser, check the web server log files. for example, if CentOS/RH/Fedora, try (as root):
and you should get some helpful info there. If the files/directories need to be accessed by the web server, then all the dirs leading up to that dir need to be readable/executable by the user running the webserver (apache, nobody, etc.). Show the permissions of those dirs (via "ls -l" output) if you are in doubt.Code:tailf /var/log/httpd/error_log
- 12-09-2012 #7Just Joined!
- Join Date
- Nov 2012
- Posts
- 10
I'll try to explain things as simply as I can.
Lets say I need a "blog" account created. He need to have his home directory set to "/home/web/blog", so when he logs into filezilla or through SSH, he only has access to all the files
after that home directory. He needs read, write and execute permissions.
I do not want him to have access to any folders or files before /blog.
How can I do that?
- 12-10-2012 #8Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,683
Google setting up chroot jailing for your distro, I think that is what you want to do. anyway it is what I have done in the past to achieve this. Doing it for sftp/ftp is straight-forward, but I recall remote shell (ssh, etc.) being a little trickier (but still doable).
- 12-10-2012 #9Linux Newbie
- Join Date
- Dec 2011
- Posts
- 119
I just logged in as root and typed
and now I have user 'blog' with home at /home/web/blog and password 'blogger'. Found an empty login somewhere, and logged in. That simple.Code:mkdir /home/web adduser -d /home/web/blog -m blog passwd blog Changing password for user blog. New UNIX password: ****** BAD PASSWORD: it is based on a dictionary word Retype new UNIX password: ****** passwd: all authentication tokens updated successfully.
- 12-11-2012 #10Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,683
That will not prevent the user blog from changing to say /home, or /, as the OP requested. For that, you need something that does chrooting.


Reply With Quote

