Question regarding file modes

Holger Schurig hs4233 at mail.mn-solutions.de
Fri Nov 12 14:21:31 CET 2004


man fai says:

       -m user,group,mode
              Set user, group and mode for all copied files (mode as octal number, user and group
              numeric  id or name).  If not specified, use file file-mode or data of source file.

however, it should be 'file-modes', not 'file-mode'.


However, I have a file /usr/local/share/fai/files/etc/quagga/zebra.conf/GATEWAY which contains

--------------------------
quagga quagga 640
--------------------------

After install, shell.log says just

--------------------------
reading /fai/files/etc/quagga/zebra.conf/file-modes
--------------------------

without any problems. Unfortunately, when I later boot, the file has the wrong owner:

--------------------------
-rw-r-----  1 root   root   106 Nov 12 13:44 zebra.conf
--------------------------

The fcopy took place very late in the installation, via scripts/LAST/S80-fcopy-recursive:

--------------------------
#!/bin/sh

fcopy -B -r /

exit 0
--------------------------


So, I guess the error is because of fcopy's name2num function:

--------------------------
sub name2num {

  # convert names to numeric uid, gid
  my ($user,$group) = @_;
  my $uid = ($user  =~ /^\d+$/) ? $user  : getpwnam $user;
  my $gid = ($group =~ /^\d+$/) ? $group : getgrnam $group;
  warn "name2id $user = $uid ; $group = $gid\n" if $debug;
  return ($uid,$gid);
}
--------------------------

which uses getpwnam / getgrnam.  This is wrong, because the uid and gid should
be taken from $target/etc/passwd or $target/etc/group, but not from /etc/passwd
or /etc/group.


-- 
M&N Solutions GmbH       http://www.mn-solutions.de
Holger Schurig
Dieselstr. 18
61191 Rosbach v.d.Höhe
Tel: (+49) 6003 9141 0   Fax: (+49) 6003 9141 49



More information about the linux-fai mailing list