+sub mkfid {
+ my $ad = dirname($aa);
+ mkdir $ad;
+ open $aa,'>',$aa or die "$0: cannot create $aa - $!\n";
+ print {$aa} "$admin_pw\n";
+ close $aa;
+ my $fd = dirname($fid);
+ mkdir $fd;
+ rename $fid,$fid.'_save';
+ open $fid,'>',$fid or die "$0: cannot create $fid - $!\n";
+ print {$fid} "$hostname:$opt_p\n";
+ print {$fid} "$admin\n";
+ print {$fid} "$admin_pw\n";
+ close $fid;
+ chownr('fex',$ad,$fd);
+ chmod 0700,$ad,$fd;
+}
+
+sub chownr {
+ my $user = shift;
+ local $_;
+ foreach (@_) {
+ if (m:^/*(lib|usr|home)?/*$:) {
+ die "ERROR: short path in chownr $user @_\n";
+ }
+ }
+ system qw'chown -R',$user,@_;
+}
+
+sub chmodr {
+ my $mod = shift;
+ local $_;
+ foreach (@_) {
+ if (m:^/*(lib|usr|home)?/*$:) {
+ die "ERROR: short path in chmodr $mod @_\n";
+ }
+ }
+ system qw'chmod -R',$mod,@_;
+}