To control the default permissions that are given to every new file you create, you use the umask (user mask) command.
The umask command sets up a file creation mask. Setting a mask is the opposite of setting the permissions themselves; when you set a mask, you are telling the computer the permissions you do not want, rather than the permissions you do.
To set the default file permissions on new files you create
rw-r-----, you could add the following line
to your .profile or .login:
umask 137This is the opposite of saying chmod 640. If you wanted to set a umask for
rw-rw----, it would be:
umask 117A umask that allowed read and write permission for everyone would be:
umask 111A umask that denied permissions to everyone except the owner of the file would be:
umask 177You can see your current umask by typing umask and pressing <Enter>. If umask is not explicitly set in one of your shell startup files, the computer shows you a default umask.
You can change your umask at the command line by typing umask, then the value you want your mask to have, then pressing <Enter>. Keep changing your umask and creating and listing files until you get the default permissions you want.