I have executed a shell script in which I have copied a file as root user in another user as:
cp myFile.txt /opt/another_user/some_dir/
The file permissions in that user are -rw-r--r--
but I have the replica of this machine, where I executed the same command but the permissions of file are -rwxr-x---
.
Why this default permission is different in 2 machines. Whether we set some rules while creating the user.
RTFM. Specically the
umask
FM, viaman umask
You may also want to check what your chosen shell's manual page says about umask.