Debian bug report logs - #1500 adduser makes a .bash_profile in the invoking user's directory Package: adduser ; Reported by: Ian Jackson ; 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:48:36 1995 Return-Path: Received: from pixar.com by mongo.pixar.com with smtp (Smail3.1.28.1 #15) id m0t7OB1-000BtHC; Mon, 23 Oct 95 07:48 PDT Received: from irz101.inf.tu-dresden.de by pixar.com with SMTP id AA26882 (5.67b/IDA-1.5 for debian-bugs-done-pipe@mongo.pixar.com); Mon, 23 Oct 1995 07:48:00 -0700 Received: by irz101.inf.tu-dresden.de (8.6.12/8.6.12-s1) id PAA14353; Mon, 23 Oct 1995 15:47:45 +0100 Date: Mon, 23 Oct 1995 15:47:45 +0100 From: sr1@irz301.inf.tu-dresden.de (Sven Rudolph) Message-Id: <199510231447.PAA14353@irz101.inf.tu-dresden.de> To: debian-bugs-done@pixar.com, iwj10@cus.cam.ac.uk Subject: Re: Bug#1500: adduser makes a .bash_profile in the invoking user's directory > Package: adduser > Version: 1.94-1 > > I recently used the adduser script for the first time in a while, and > was most puzzled when bash stopped executing my .profile. > > Eventually I tracked it down to a rogue .bash_profile file that had > been created by some program. I deleted the .bash_profile, and bash > worked properly again. > > I just ran adduser again and it put the .bash_profile back ! > > My cwd and HOME were all set to /u/ian, and I have used the > adduser.conf variable to set the home directories to appear under /u. > The user whose account I was creating didn't have their .bash_profile > edited by adduser to make the umask 002 (it should have been edited, > since I have usergroups turned on). > > I suspect the lack of a directory name in a destination filename > somewhere. 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 Jackson : 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 Thu Sep 28 19:48:08 1995 Return-Path: Received: from pixar.com by mongo.pixar.com with smtp (Smail3.1.28.1 #15) id m0syVUd-0001ceC; Thu, 28 Sep 95 19:48 PDT Received: from bootes.cus.cam.ac.uk by pixar.com with SMTP id AA06455 (5.67b/IDA-1.5 for debian-bugs-pipe@mongo.pixar.com); Thu, 28 Sep 1995 19:47:48 -0700 Received: by bootes.cus.cam.ac.uk (Smail-3.1.29.0 #36) id m0syVUa-000BzQC; Fri, 29 Sep 95 03:48 BST Received: by chiark id (Debian /\oo/\ Smail3.1.29.1 #29.33); Fri, 29 Sep 95 03:11 BST Message-Id: Date: Fri, 29 Sep 95 03:11 BST From: Ian Jackson To: Debian bugs submission address Subject: Re: Bug#1500: adduser makes a .bash_profile in the invoking user's directory In-Reply-To: References: Here is a better version of my patch, which also supplies the home directory to adduser.local. Ian. --- /usr/sbin/adduser Mon Jul 10 02:10:53 1995 +++ /usr/local/sbin/adduser Thu Sep 28 19:31:07 1995 @@ -671,14 +671,14 @@ $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; } close FILE; close NEWFILE; - rename ("$file.new", "$file") || die "rename: $!"; + rename ("$this_file.new", "$this_file") || die "rename: $!"; } } } @@ -719,6 +719,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; } ----------------------------------------------------------------------- Acknowledgement sent to Ian Jackson : Extra info received and forwarded. Full text available. ----------------------------------------------------------------------- Information forwarded to debian-devel@pixar.com : Bug#1500 ; Package adduser . Full text available. ----------------------------------------------------------------------- Message received at debian-bugs: From thor.cam.ac.uk!iwj10 Thu Sep 28 07:03:56 1995 Return-Path: Received: from pixar.com by mongo.pixar.com with smtp (Smail3.1.28.1 #15) id m0syJZ6-000EyUC; Thu, 28 Sep 95 07:03 PDT Received: from hammer.thor.cam.ac.uk by pixar.com with SMTP id AA29201 (5.67b/IDA-1.5 for debian-bugs-pipe@mongo.pixar.com); Thu, 28 Sep 1995 07:03:36 -0700 Received: by hammer.thor.cam.ac.uk (Smail-3.1.29.0 #77) id m0syJZ1-000JfRC; Thu, 28 Sep 95 15:03 BST Message-Id: Date: Thu, 28 Sep 95 15:03 BST From: iwj10@thor.cam.ac.uk (Ian Jackson) To: debian-bugs@pixar.com Subject: Re: Bug#1500: adduser makes a .bash_profile in the invoking user's directory In-Reply-To: <11479@toto.iv> References: I reported that adduser creates a .bash_profile file in the invoking user's current directory. On examining the code, it seems that if /etc/skel contains a .login or a .profile it will write those too. Below is a patch that I believe will fix the problem. It also adds a new feature: after creating a new user, adduser will run /usr/local/sbin/adduser.local if it exists, passing as arguments the new username, its uid and its gid. Ian. --- /usr/sbin/adduser Mon Jul 10 02:10:53 1995 +++ adduser Thu Sep 28 14:59:59 1995 @@ -671,14 +671,14 @@ $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; } close FILE; close NEWFILE; - rename ("$file.new", "$file") || die "rename: $!"; + rename ("$this_file.new", "$this_file") || die "rename: $!"; } } } @@ -719,6 +719,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); + die "exec adduser.local: $!"; + } exit 0; } ----------------------------------------------------------------------- Acknowledgement sent to iwj10@thor.cam.ac.uk (Ian Jackson) : Extra info received and forwarded. Full text available. ----------------------------------------------------------------------- Information forwarded to debian-devel@pixar.com : Bug#1500 ; Package adduser . Full text available. ----------------------------------------------------------------------- Message received at debian-bugs: From cus.cam.ac.uk!iwj10 Thu Sep 28 04:16:09 1995 Return-Path: Received: from pixar.com by mongo.pixar.com with smtp (Smail3.1.28.1 #15) id m0syGwj-000F08C; Thu, 28 Sep 95 04:16 PDT Received: from bootes.cus.cam.ac.uk by pixar.com with SMTP id AA22432 (5.67b/IDA-1.5 for debian-bugs-pipe@mongo.pixar.com); Thu, 28 Sep 1995 04:15:49 -0700 Received: by bootes.cus.cam.ac.uk (Smail-3.1.29.0 #36) id m0syGwd-000C0JC; Thu, 28 Sep 95 12:16 BST Received: by chiark id (Debian /\oo/\ Smail3.1.29.1 #29.33); Thu, 28 Sep 95 12:13 BST Message-Id: Date: Thu, 28 Sep 95 12:13 BST From: Ian Jackson To: Debian bugs submission address Subject: adduser makes a .bash_profile in the invoking user's directory Package: adduser Version: 1.94-1 I recently used the adduser script for the first time in a while, and was most puzzled when bash stopped executing my .profile. Eventually I tracked it down to a rogue .bash_profile file that had been created by some program. I deleted the .bash_profile, and bash worked properly again. I just ran adduser again and it put the .bash_profile back ! My cwd and HOME were all set to /u/ian, and I have used the adduser.conf variable to set the home directories to appear under /u. The user whose account I was creating didn't have their .bash_profile edited by adduser to make the umask 002 (it should have been edited, since I have usergroups turned on). I suspect the lack of a directory name in a destination filename somewhere. Ian. ----------------------------------------------------------------------- Acknowledgement sent to Ian Jackson : New bug report received and forwarded. Full text available. ----------------------------------------------------------------------- Report forwarded to debian-devel@pixar.com : Bug#1500 ; 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