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 |
Isn't it possible to make the directory and then set it add the user?
OR I suppose it could be easily done afterwards.... |
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 |
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. |
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? |
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. |
Must be a distro drifference; adduser under debian is a perl script!
|
All times are GMT -5. The time now is 09:10 PM. |