Working as User other than Root in %post

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello All,

In the %post section, I add a user called 'jason' then I copy over some
*.tgz files from the NFS server.  The owner and group for those files is
root.  If I change the owner/group to 'jason' and untar the files into
/home/jason, all the files are owned by jason but the directories created
are owned by root.  I suppose this is because I untar them as root.  I need
those directories to belong to jason.  I could do a chmod on the
directories but I was hoping there was a different answer.  My question
is......is there a way to 'login' as jason and untar the files in the %post
section?

Thanks!
Rebecca


%post
## Add a user
useradd -c "Software System User" -m jason -p ABuoRyJppdRQ

## mount an NFS server
mkdir /mnt/tmp
echo "Mounting an NFS server and copying over files"
mount -o nolock,ro,rsize=8192,wsize=8192 10.1.1.1:/redhat.disks /mnt/tmp

## copy packages needed to install dosemu
cp /mnt/tmp/dosemu/dosemu*.tgz /home/jason

## unmount the NFS server
umount /mnt/tmp
rm -fr /mnt/tmp

echo "Installing DosEmu"
cd /home/jason
chown jason *.tgz
chgrp jason *.tgz
tar -xzvf dosemu-freedos-bin.tgz
tar -xzvf dosemu-1.0.2-bin.tgz
##rm -fr dosemu*bin.tgz






[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux