I would like to find the umask value for a particular system user, the one that is applied when a script running as this user creates a new directory. I'm using both Ubuntu 16.04 and 20.04 systems.
The closest answer I can find to this is this question. I don't understand a word of it, but I tried the script
for user in $(awk -F: '{print $1}' /etc/passwd);
do
printf "%-10s" "$user" ; su -c 'umask' -l $user 2>/dev/null
done
given in the accepted answer; it printed the word "root" and then froze the system.
How do I find the umask value for a given system user?
su
wrote itsPassword:
prompt to standard output (which you discarded) and is waiting for you to respond – steeldriver May 23 '21 at 21:26su
asks for a password and it will hang. However, that segues into a recommendation that you don't ever run shell scripts that you don't understand, especially as the root user. – Chris May 23 '21 at 21:39umask
command as the appropriate user? Seeumask --help
– Jeremy Boden May 31 '21 at 16:36