LinuxQuestions.org
Help answer threads with 0 replies.
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 06-08-2015, 08:45 AM   #1
johnmaxwell
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, 11:02 AM   #2
dmunkz
LQ Newbie
 
Registered: Jun 2015
Distribution: rpm based
Posts: 13

Rep: Reputation: Disabled
try this with useradd

Hello,

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


Code:
userdel YOUR_USER && useradd -g YOUR_GROUP -d YOUR_DIRECTORY YOUR_USER
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, 11:06 AM   #3
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,463

Rep: Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066
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 11:07 AM.
 
  


Reply


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 09:11 AM
[SOLVED] useradd not creating home directory magnusprime Solaris / OpenSolaris 7 01-27-2010 05:08 PM
[SOLVED] useradd and the home directory. stf92 Linux - Newbie 7 09-16-2009 08:42 AM
useradd - No home directory is created ]SK[ Linux - Newbie 16 07-14-2008 01:35 PM


All times are GMT -5. The time now is 12:43 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration