Debian bug report logs - #1544 usergroups in adduser Package: adduser ; Reported by: Ian Murdock ; Done: sr1@irz301.inf.tu-dresden.de (Sven Rudolph). ----------------------------------------------------------------------- Message received at debian-bugs-done: From irz301.inf.tu-dresden.de!sr1 Mon Oct 23 07:54:20 1995 Return-Path: Received: from pixar.com by mongo.pixar.com with smtp (Smail3.1.28.1 #15) id m0t7OGa-000BVdC; Mon, 23 Oct 95 07:54 PDT Received: from irz101.inf.tu-dresden.de by pixar.com with SMTP id AA27080 (5.67b/IDA-1.5 for debian-bugs-done-pipe@mongo.pixar.com); Mon, 23 Oct 1995 07:53:39 -0700 Received: by irz101.inf.tu-dresden.de (8.6.12/8.6.12-s1) id PAA14465; Mon, 23 Oct 1995 15:52:58 +0100 Date: Mon, 23 Oct 1995 15:52:58 +0100 From: sr1@irz301.inf.tu-dresden.de (Sven Rudolph) Message-Id: <199510231452.PAA14465@irz101.inf.tu-dresden.de> To: debian-bugs-done@pixar.com, iwj10@cus.cam.ac.uk Subject: Re: Bug#1544: usergroups in adduser > Package: adduser > Version: 1.94-1 > > Users added when using usergroups should have home directories with > mode 2775, and all skeletal files should be g+w. This is how it is > currently created: I fixed this in adduser-1.94-2. (I will upload it this evening.) Sven -- Sven Rudolph (sr1@inf.tu-dresden.de); WWW : http://www.sax.de/~sr1/ ----------------------------------------------------------------------- Notification sent to Ian Murdock : Bug acknowledged by developer. Full text available. ----------------------------------------------------------------------- Reply sent to sr1@irz301.inf.tu-dresden.de (Sven Rudolph) : You have taken responsibility. Full text available. ----------------------------------------------------------------------- Message received at debian-bugs: From cus.cam.ac.uk!iwj10 Wed Oct 4 17:26:42 1995 Return-Path: Received: from pixar.com by mongo.pixar.com with smtp (Smail3.1.28.1 #15) id m0t0e94-0008ozC; Wed, 4 Oct 95 17:26 PDT Received: from bootes.cus.cam.ac.uk by pixar.com with SMTP id AA08118 (5.67b/IDA-1.5 for debian-bugs-pipe@mongo.pixar.com); Wed, 4 Oct 1995 17:24:46 -0700 Received: by bootes.cus.cam.ac.uk (Smail-3.1.29.0 #36) id m0t0dMX-000BzZC; Thu, 5 Oct 95 00:36 BST Received: by chiark id (Debian /\oo/\ Smail3.1.29.1 #29.33); Thu, 5 Oct 95 00:19 BST Message-Id: Date: Thu, 5 Oct 95 00:19 BST From: Ian Jackson To: debian-bugs@pixar.com Subject: Re: Bug#1544: usergroups in adduser Ian Murdock writes ("Bug#1544: usergroups in adduser"): > Package: adduser > Version: 1.94-1 > > Users added when using usergroups should have home directories with > mode 2775, and all skeletal files should be g+w. This is how it is > currently created: > > $ ls -la /mnt/home/imurdock > total 4 > drwxr-xr-x 2 imurdock imurdock 1024 Oct 3 23:14 . > drwxrwsr-x 3 root staff 1024 Oct 3 23:14 .. > -rw-r--r-- 1 imurdock imurdock 133 Oct 3 23:14 .bash_profile > -rw-r--r-- 1 imurdock imurdock 114 Oct 3 23:14 .bashrc This is because it uses the umask (presumably your root umask is 022 - mine is 002). Here is yet another version of my patch to adduser. This one incorporates all of my previous changes, and fixes a few other problems too: * honour --home when creating non-system users * create home directory with setgid bit when using usergroups. * copy permissions of dotfiles from /etc/skel, but modified so that the group permissions are the same as the user permissions (usergroups) or as the other permissions (not user- groups). * run /usr/local/sbin/adduser.local if it exists. * don't break the dotfiles permissions while doing the umask modification. Ian. --- /usr/sbin/adduser Mon Jul 10 02:10:53 1995 +++ /usr/local/sbin/adduser Wed Oct 4 21:50:45 1995 @@ -602,7 +602,11 @@ ## add the new user to the passwd file ## print "Updating password file... " if ($verbose); - $home_dir = $config{"home"} . "/" . $new_name; + if ($special_home) { + $home_dir = $special_home; + } else { + $home_dir = $config{"home"} . "/" . $new_name; + } &add_user_to_file($new_name, $new_uid, $new_gid, @@ -651,6 +655,7 @@ } mkdir ($home_dir, $dir_mode); chown ($new_uid, $new_gid, $home_dir); + chmod ($dir_mode, $home_dir); print "done.\n" if ($verbose); ## @@ -666,19 +671,25 @@ ## change umask lines in appropriate skel files ## if we're using usergroups. ## + local (@statreturn); if ($config{"usergroups"} eq "yes") { foreach $file (".login", ".profile", ".bash_profile") { $this_file = $home_dir . "/" . $file; if (-f $this_file) { open (FILE, "$this_file") || die "open: $!"; - open (NEWFILE, ">$file.new") || die "open: $!"; + open (NEWFILE, ">$this_file.new") || die "open: $!"; while ($line = ) { $line =~ s/umask 0([267])\1/umask 00$1/; - print NEWFILE $line; + print(NEWFILE $line) || die "write: $!"; } + + (@statreturn= stat(FILE)) || die "fstat: $!"; + $filemode= $statreturn[2]; + chmod($statreturn[2],"$this_file.new") || die "chmod: $!"; + close FILE; - close NEWFILE; - rename ("$file.new", "$file") || die "rename: $!"; + close(NEWFILE) || die "close: $!"; + rename ("$this_file.new", "$this_file") || die "rename: $!"; } } } @@ -719,6 +730,11 @@ } print "done.\n"; &clean_up(); + if (-f "/usr/local/sbin/adduser.local") { + exec("/usr/local/sbin/adduser.local", + $new_name, $new_uid, $new_gid, $home_dir); + die "exec adduser.local: $!"; + } exit 0; } @@ -867,11 +883,21 @@ open (NEWFILE, ">$dir/$file") || die "open: $!"; while () { - print NEWFILE; + print(NEWFILE) || die "print: $!"; } + local (@statreturn,$filemode); + (@statreturn= stat(FILE)) || die "fstat: $!"; + $filemode= $statreturn[2]; + if ($config{"usergroups"} eq "yes") { + $filemode= ($filemode & 0707) | (($filemode & 0700)>>3); + } else { + $filemode= ($filemode & 0707) | (($filemode & 0007)<<3); + } + chmod($filemode,"$dir/$file") || die "chmod: $!"; + close FILE; - close NEWFILE; + close(NEWFILE) || die "close: $!"; return 1; } @@ -1246,7 +1272,3 @@ print STDERR " --debug Display plenty of debugging information.\n"; print STDERR "Global configuration is in the file '/etc/adduser.conf'\n"; } - - - - ----------------------------------------------------------------------- Acknowledgement sent to Ian Jackson : Extra info received and forwarded. Full text available. ----------------------------------------------------------------------- Information forwarded to debian-devel@pixar.com : Bug#1544 ; Package adduser . Full text available. ----------------------------------------------------------------------- Message received at debian-bugs: From debian.org!imurdock Wed Oct 4 06:28:47 1995 Return-Path: Received: from pixar.com by mongo.pixar.com with smtp (Smail3.1.28.1 #15) id m0t0TsN-0005zZC; Wed, 4 Oct 95 06:28 PDT Received: from imagine.imaginit.com by pixar.com with SMTP id AA29786 (5.67b/IDA-1.5 for debian-bugs-pipe@mongo.pixar.com); Wed, 4 Oct 1995 06:28:25 -0700 Received: by imagine.imaginit.com id (Debian /\oo/\ Smail3.1.29.1 #29.33); Wed, 4 Oct 95 08:32 EST Message-Id: Date: Wed, 4 Oct 95 08:32 EST From: Ian Murdock To: debian-bugs@pixar.com Subject: usergroups in adduser Package: adduser Version: 1.94-1 Users added when using usergroups should have home directories with mode 2775, and all skeletal files should be g+w. This is how it is currently created: $ ls -la /mnt/home/imurdock total 4 drwxr-xr-x 2 imurdock imurdock 1024 Oct 3 23:14 . drwxrwsr-x 3 root staff 1024 Oct 3 23:14 .. -rw-r--r-- 1 imurdock imurdock 133 Oct 3 23:14 .bash_profile -rw-r--r-- 1 imurdock imurdock 114 Oct 3 23:14 .bashrc ----------------------------------------------------------------------- Acknowledgement sent to Ian Murdock : New bug report received and forwarded. Full text available. ----------------------------------------------------------------------- Report forwarded to debian-devel@pixar.com : Bug#1544 ; Package adduser . Full text available. ----------------------------------------------------------------------- Ian Jackson / iwj10@thor.cam.ac.uk , with the debian-bugs tracking mechanism This page last modified 07:43:01 GMT Wed 01 Nov