Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 06-08-2015, 09:45 AM   #1
LQ Newbie
Registered: Feb 2014
Posts: 20

Rep: Reputation: Disabled
Unhappy useradd command used for specific home directory but dont get full access

useradd -c "the body holiday dev user" -m -d /var/www/html/thebodyholiday/ -N -G apache tbholiday

With this command i wanted the tbholiday user to directly login to /var/www/html/thebodyholiday/ directory, by being a member in the apache group.

All i want is that all the files and folders of that dirtory should belong to the user tbholiday and group apache by default, with 775 permission and the user tbholiday should be able to run any command in that directory /var/www/html/thebodyholiday/ like a root user.

but all the files dont have this permission setup, i have to run chown -R tbholiday:apache thebodyholiday/ chmod -R 0775 thebodyholiday/ these two command every two to thrww days when new files or folder is created.

And user tbholiday can not update the wordpress plugin or any updates automatically, it ask for root permission, so for the time being i ran visudo command and added tbholiday = All(All:All)All so now it do ask for password, but the user got full access like root user, i dont want this. I just want the user tbholiday to run any command or update or anything in that directoy, but not any other place.

Please help. Urgent. And thanks to you all.
Old 06-08-2015, 12:02 PM   #2
LQ Newbie
Registered: Jun 2015
Distribution: rpm based
Posts: 13

Rep: Reputation: Disabled
try this with useradd


Can you try the below, substituting your user name in place.

In the above :
YOUR_USER : an ls -al against your web directory should look like this : YOUR_USER(owner) YOUR_GROUP(the group) PERMS (I typically think 755 for doc roots.).

It sounds like your permissions are wonked up. If for example, /var/www/site/bin had the wrong permissions OR any thing along the path, you would see issues like that.
Old 06-08-2015, 12:06 PM   #3
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138
useradd does NOT change the permissions in the intended "home" directory to automatically belong to the user you add. Nor does having a user with some directory as their home force ALL files written to that directory by ANY user to be automatically changed to user who has that as their home directory.

That's not how permissions work. Users do not automatically "inherit" any and all files that are written to their home directory by anybody. File permissions are file permissions, it makes no difference where somebody's "home" is.

Last edited by suicidaleggroll; 06-08-2015 at 12:07 PM.


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
useradd: cannot create directory /home/ amirzkria Red Hat 5 08-07-2014 10:11 AM
[SOLVED] useradd not creating home directory magnusprime Solaris / OpenSolaris 7 01-27-2010 06:08 PM
[SOLVED] useradd and the home directory. stf92 Linux - Newbie 7 09-16-2009 09:42 AM
useradd - No home directory is created ]SK[ Linux - Newbie 16 07-14-2008 02:35 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:44 AM.

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