Pierre Labastie wrote:
If I use "su", my umask as root is the same as that of pierre (0002)
If I use "su -", umask is correctly set to 0022 (but of course the working
directory is changed to /root)
what I use in my scripts is
sudo -E sh << ROOT_EOF
If I do that, umask is 0022, and CWD is not changed. I cannot understand
what makes the difference with su (I do not use this command, that's why...)
su without the dash switches the user without affecting the environment.
With the dash, does the same as if root logged. The man page fo rsu says:
"The optional argument - may be used to provide an environment similar to
what the user would expect had the user logged in directly."
sudo -E says"
Indicates to the security policy that the user wishes to preserve their
existing environment variables. The security policy may return an error if
the user does not have permission to preserve the environment.
sudo does not change the umask by default.
I agree that install would be the better instruction for sendmail. I have
found the better way to handle 'here' documents is to do something like:
# Create the file locally in build phase -- does not need to be root
cat > aliases << "EOF"
# Put in place as root
install -m755 /etc/mail
install -m644 aliases /etc/mail/aliases
I do not think that owner and group need to be specified because we would
be running as root.
Unsubscribe: See the above information page