LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-17-2004, 02:51 PM   #1
skunkburner
Member
 
Registered: Mar 2004
Distribution: Fedora Core 17 & 18, Debian Wheezy
Posts: 137

Rep: Reputation: 16
How can I define permissions on a /home/user dir _before_ creating it with adduser


Hi

I am setting up an apache server with /~user access on RH9, and am trying to create the user directories with the appropriate permissions in place.

I have found the /etc/skel dir and found setting the public_html in there to 755(or whatever) makes the /home/user/public_html to 755 as well.

I would like to know how I can set the /home/user dir to have 711 permission when it is created with the adduser command. setting the /etc/skel to 711 doesn't work : (

Thanks in advance

Skunkburner
 
Old 03-17-2004, 04:11 PM   #2
DoubleOTeC
Member
 
Registered: Aug 2003
Location: Dominica
Distribution: RedHat, FC1, FC3, FC4
Posts: 266

Rep: Reputation: 30
Isn't it possible to make the directory and then set it add the user?

OR

I suppose it could be easily done afterwards....
 
Old 03-17-2004, 05:14 PM   #3
cyberfunk
LQ Newbie
 
Registered: Oct 2003
Posts: 14

Rep: Reputation: 0
I guess one way of doing it would be

useradd <blahblahblah> -d <directory> <blahblahblah>;mkdir <directory>;chmod 711 <directory>

If you popped that into a shell script with some variables, it would happen almost instantly, but I think if you created the directory before you added the users with those perms, useradd might complain... well it would on hpux anyways...

Cyber
 
Old 03-17-2004, 05:59 PM   #4
liamoboyle
Member
 
Registered: Mar 2004
Location: Wellington, New Zealand
Distribution: Debian
Posts: 127

Rep: Reputation: 15
Edit the adduser command so that it sets new user directories to what you want

liam@loki:~$ su -
Password:
loki:~# vi `which adduser`

There is a line like this -
$config{"dir_mode"} = "0755";

if you set it to
$config{"dir_mode"} = "0711";

Then you'll be sweet.
 
Old 03-18-2004, 05:35 AM   #5
skunkburner
Member
 
Registered: Mar 2004
Distribution: Fedora Core 17 & 18, Debian Wheezy
Posts: 137

Original Poster
Rep: Reputation: 16
Hi Liam

OK I followed your explaination until just after vi 'which adduser'
adduser is an ELF executable and only shows up as garbage in vi.
I tried using the vi command :!xxd which converted it to hex,
but I still couldn't see anything like $config{"dir_mode"} = "0711";

what am I doing wrong?
 
Old 03-18-2004, 06:20 AM   #6
skunkburner
Member
 
Registered: Mar 2004
Distribution: Fedora Core 17 & 18, Debian Wheezy
Posts: 137

Original Poster
Rep: Reputation: 16
Thanks for the help but I've just worked it out.

I needed to add the line 'umask 066' to /etc/login.defs and the /home/user dir was created with the appropriate permissions.
 
Old 03-18-2004, 03:42 PM   #7
liamoboyle
Member
 
Registered: Mar 2004
Location: Wellington, New Zealand
Distribution: Debian
Posts: 127

Rep: Reputation: 15
Must be a distro drifference; adduser under debian is a perl script!
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
adduser but no shell and no home dir ryedunn Linux - Newbie 7 09-05-2011 09:52 AM
user home dir doesn't create when new user add dev_mohamed Linux - Software 3 01-12-2007 01:08 AM
Permissions home dir reset automatically Marco Vermunt Linux - Newbie 1 01-24-2005 01:50 PM
user home dir/permissions xilace Linux - Security 5 07-21-2004 12:33 PM
I have an nfs mounted /home and 'adduser' fails to create a new user dipukm Linux - Software 4 06-01-2004 06:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:14 PM.

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
Open Source Consulting | Domain Registration