I have the following code executed in the %post section of a kickstart file for RHEL 6.6.

echo '#!/bin/sh' > /root/add_user
echo 'if [ $# -lt 1 ]; then echo "no username provided"; exit 1; fi' >> /root/add_user
echo 'set -e' >> /root/add_user
echo 'useradd $1 -g foo -G wheel,dialout,sshusers -m' >> /root/add_user
echo 'passwd $1' >> /root/add_user
chmod +x /root/add_user

The file is created correctly however is not chmoded with executable permissions. I have a log file as well for the post section and no error is reported in terms of the chmod command or any other errors at all. I can not figure out why the file is unable to be set to have executable permissions, any idea why this may be happening?


When I do a verbose chmod I get the following in the log

mode of /root/add_user retained as 0755
  • What permissions does /root/add_user end up with? If it's really 0755, it's already executable. – Lars Rohrbach May 6 '15 at 15:44
  • I actually just found the answer but won't be helpful to anyone not locking down a machine, after I set the file to be executable another rpm would execute that got rid of execute in all of the root folder. So the solution was to change the chmod to the end of the kickstart. – jgr208 May 6 '15 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.